Manual:$wgNoFollowLinks/en

Details
If true, external URL links in wiki text will be given the  attribute as a hint to search engines that they should not be followed for ranking purposes as they are user-supplied and thus subject to spamming. Defaults to true.

Setting nofollow for red links
It may be desirable to configure MW to append  to internal links that point to pages that haven't yet been written (so-called "red links") for various reasons that include avoiding unnecessary crawler traffic to non-extant pages or for the possibility of improved SEO by avoiding punitive action against a site's ranking due to the presence of "broken links" that aren't broken, just not yet authored.

This may be accomplished by using the  hook as follows: