MyBB Community Forums

Full Version: Adding nofollow to outgoing links
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
(2010-11-13, 05:58 PM)querschlaeger Wrote: [ -> ]Ah, after a longer view I found it!

(2010-11-11, 01:03 PM)mahigrafix Wrote: [ -> ]
<a href="http([s]?)://(|www.\)mahigrafix.com(.*?)" rel="nofollow"

You have a typo:

(|www.\) - dot and backslash are interchanged. Wink

I have the same problem
Regular: <a href="http([s]?)://(|www.\)venise.co.cc(.*?)" rel="nofollow"
Replacement: <a href="http$1://$2venise.co.cc$3"
Error:

The following warnings occurred:
Warning [2] preg_replace() [function.preg-replace]: Compilation failed: missing ) at offset 63 - Line: 342 - File: inc/class_parser.php PHP 5.3.3 (Linux)
File Line Function
[PHP] errorHandler->error
/inc/class_parser.php 342 preg_replace
/inc/class_parser.php 152 postParser->parse_mycode
/portal.php 530 postParser->parse_message

So i should change the . and \ in (|www.\) to (|www\.) ?
Because i don't get it honestly.
(2010-11-28, 11:46 AM)Ansem Wrote: [ -> ]So i should change the . and \ in (|www.\) to (|www\.) ?
Because i don't get it honestly.

Yes, change it. Sorry I made this typo in first post... Blush
Fantastic stuff, very good for SEO as well this. I do like the way it removes the Nofollow attribute from all internal inbound links (your domain) making them DoFollow links, very neat!

A little tip I spotted though, if you decide to arrange them in "Parse Order" (1 and 2), just make sure NoFollow (1) is listed before DoFollow (2). If you have it the other way around - Dofollow (1) and Nofollow (2), I've spotted the Nofollow attribute is not being removed from your own domain name inbound links by looking at the "Page Source" with FireFox on some of my forum pages that contain inbound and outbound links.

Not sure why that's the case, or why it matters? If you don't use Parse Order at all, both are set to (0) they work fine also.
NoFollow is good for seo, but it could determine users to post less. Personally, I think that leaving the links dofollow is just a proof of respect towards the ones posting. If all the forums were nofollow, would Google have any clues of how to score the websites?
I do think you have a good point there, it can help deter your members away from using your forum more. Especially if they feel your only doing it because all you care about is your own sites SEO and growth, and are being too selfish, not taking onboard the fact your members are helping your forum grow by posting there in the first place.

That said though, all the NoFollow link does is stop search engines like MSN, Google and Yahoo! from passing on page rank to them away from your own site, or it helps stop it from happening. It still doesn't stop search engine spiders from following those links, nor real real human people for that matter visiting them and maybe joining that site. So it's not all bad when you think about it more.
(2010-10-28, 01:03 PM)querschlaeger Wrote: [ -> ]Replace example.net with your own URL! If you have more sub domains than www just add them to the regular expression:

<a href="http([s]?)://(|www\.|sub1\.|sub2\.)example.net(.*?)" rel="nofollow"

Hint: This only works with stock MyBB URLs. If you use plugins which modify URLs you may have to change the regular expression!

PS: Of course it's possible to combine both regular expressions. If you are a pro please post the regular expression here! Smile

I'm using a lot of subdomains like photos, kravian.... So should i do with the do follow ???

And i'm using Google SEO plugin, will this mycode work with it ??? If not how should i need change to make it work ? My domain: mobihouse.co


Thanks for your great tuts & helps!
(2010-10-28, 01:03 PM)querschlaeger Wrote: [ -> ]Hint: This only works with stock MyBB URLs. If you use plugins which modify URLs you may have to change the regular expression!

Hi Querschlaeger!

It's interesting, because it works for me with google seo (seo URLs enabled). Smile

Other thing: Can you make one code for the user profile links too? Danke!
(2010-10-28, 01:03 PM)querschlaeger Wrote: [ -> ]PS: Of course it's possible to combine both regular expressions. If you are a pro please post the regular expression here! Smile

Sorry for the bump, just never noticed this thread before.

You could probably do something like this:

Regular Expression:
<a href="http([s]?)://((?!(|www\.)mybb.com).*?)"

Replacement:
<a href="http$1://$2" rel="nofollow"

If anyone wants to just have a single MyCode for it. Obviously replace mybb.com with your website.
Quick Question:

this works for directly pasted urls on post.

but if i have this on post
[url=http://community.mybb.com/index.php]MyBB[/url]

it will display:
Quote:target="_blank">MyBB

it will still redirect.

so, where to removed that ( "target=_blank"> )and possible retain the MyBB ?

Thanks

Its works with [ url ] tag too. Maybe you are using an URL modifying plugin?

Write this in a post:

[url=http://community.mybb.com/index.php]MyBB[/url]
[url]http://community.mybb.com/index.php[/url]
http://community.mybb.com/index.php

Then look at HTML source code. This should be the result:

<a href="http://community.mybb.com/index.php" target="_blank">MyBB</a>
<a href="http://community.mybb.com/index.php" target="_blank">http://community.mybb.com/index.php</a>
<a href="http://community.mybb.com/index.php" target="_blank">http://community.mybb.com/index.php</a> 

If there is something different you modified MyBB core files or you use an URL modifying plugin...
Pages: 1 2 3 4