MyBB Community Forums

Full Version: Rel="nofollow" all the external links... [Code Modifications]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Last update : February 15, 2015

Hello,

This is a code modification and a MyCode to add the rel="nofollow" to all your external links (to save your Google Pagerank and get higher rankings)


If you don't allow Google Bot to crawl your website, or your website can't be read by guests, there's NO need to rel="nofollow" anything!

The following setting differs between 1.6 and 1.8 :
1.6
First of all, adding rel="nofollow" to "Homepage" links on users profiles, open your "member.php" file, find:
$website = "<a href=\"{$memprofile['website']}\" target=\"_blank\">{$memprofile['website']}</a>";

Replace it with:
$website = "<a href=\"{$memprofile['website']}\" target=\"_blank\" rel=\"nofollow\">{$memprofile['website']}</a>";

Save and re-upload.

1.8
Go to your Admin CP > Templates & Style > (from the left menu) Templates > *Choose your template* > Member Templates > member_profile_website :

Change :
<a href="{$memprofile['website']}"

By :
<a href="{$memprofile['website']}" rel="nofollow"


1.6 & 1.8
 go to your Admin CP, Configuration, MyCode, Add new MyCode:

Title: Nofollow
Short description: No follow links
Regular Expression : 
<a href="http([s]?)://(.*?)"
Replacement : 
<a href="http$1://$2" rel="nofollow"
Enabled: Yes

Save.

(the following MyCode will enable the internal links to be followed by search engines)

Add new MyCode:

Title: Dofollow
Short Description: Dofollow links
Regular Expression:
<a href="http([s]?)://(|www\.)YOURWEBSITE.TLD(.*?)" rel="nofollow"
Replacement:
<a href="http$1://$2YOURWEBSITE.TLD$3"

Replace "YOURWEBSITE.TLD" by your website . tld (example google.com)
Enabled: Yes

Save.

DONE Wink
Moved to tutorials
FYI I think this is one of the best moves for any admin. Many issues are related to how Google will crawl a site with a huge amount of inbound wasteful links. If you can make sure Google concentrates on actual content you'll see a huge benefit imho in ranking and indexing.

Profiles imho should never be indexed. Then there are silly pages like stats. Google shouldn't ever see the error_no_perm page imho.
Great tutorial.

Thanks~
Hi, does a plugin exist that adds nofollow to all external URLs and dofollow to all internal URLs? This tutorial is great but I'm not a big fan of core code modifications.
thanks, very useful tut
Where do you actually go to edit the nofollow?
Would the MyCode suffice nofollow to signatures as well?
edit: Aw snap, I lost it. Yeah they would, nice tutorial btw.
Is the replacement for the second one supposed to be?:

* <a href="http$1://$2YOURWEBSITE.TLD$3"

Or am I supposed to move that extra asterisk?
Hi, my forum is inside a folder, when I insert the url, I do so on the mycode?

<a href="http([s]?)://(|www\.)url.com/folder(.*?)" rel="nofollow"

<a href="http$1://$2url.com/folder$3"
Pages: 1 2 3