Manual:$wgNoFollowDomainExceptions

Details
If this is set to an array of domains, external links to these domain names (or any subdomains) will not be set to  regardless of the value of $wgNoFollowLinks.

For instance: This would add  to links to de.wikipedia.org, but not en.wikipedia.org, wiktionary.org, en.wiktionary.org, us.en.wikipedia.org, etc.