If you are using Wordpress, you can try this plugin to auto nofollow all external URL https://wordpress.org/plugins/auto-nofollow-links/
If not, you can easily program a functions that auto add rel="nofollow" to any URL point to a domain that not yours