How to Add rel=”nofollow” on the links on XenForo forums

How to add nofollow external links on XenForo forums? How to add rel=”nofollow” on all outbound links on XenForo? XenForo is much popular commercial internet forum software package that written in PHP programming language. XenForo is used as a good alternative for vBulletin.
XenForo has several SEO features built in, however the link to the sentence backlink spam as a problem occurs. To avoid spamming on your XenForo forums you should add the rel = ‘nofollow’ links to avoid slap spammers.

So how to add rel=”nofollow” on XenForo forums? Here is the steps to do that……

Open the file / library / XenForo / Helper / String.php find the following code:

public static function getLinkClassTarget($url)
 $target = '_blank';
 $class = 'externalLink';
 $type = 'external';
 $urlInfo = @parse_url($url);
 if ($urlInfo)
 $host = $urlInfo['host'] . (!empty($urlInfo['port']) ? ":$urlInfo[port]" : '');
 if ($host == XenForo_Application::$host)
 $target = '';
 $class = 'internalLink';
 $type = 'internal';
 return array($class, $target, $type);

Replace the following Sentence

$class = 'externalLink';

With this Sentence

$class = 'externalLink" rel="nofollow';

Click save and you are done. Now the links from your XenForo forum will be in nofollow attribute.

About Mohammed Anzil

Professional Blogger, SEO, and Web Developer. Founder of and CoFounder of

View all posts by Mohammed Anzil →