PhpBB mod :: nofollow, clean up urls, stop spammy linkers
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3922
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
If you run a forum, you know there's a big problem with forum spammers throwing up links, in members www links, in signatures, and in the the topic body text itself. Sometimes it's hard to be sure it's spam, they get tricky. But one thing you do know: they aren't going to spend that much time posting a lot since they usually get paid per link.

The Nofollow Antispam mod helps phpBB forum owners protect themselves against these potentially damaging backlinks, which often point to bad neighborhood type sites that can damage your forum's rankings in the serps.

While you could make all links nofollow, in the new user's www site link, posting topic body, and signature, by just changing the bbcode.tpl url item, it's nicer to allow your users to create links that will get link credit when appropriate.

This mod gives you the flexibility to do both, have protection against spammers, who won't be posting more than a few posts, and letting search engines and your users benefit from having standard links that search engines can follow.

You can download the zip version here: techpatterns.com/downloads/mods/nofollow.zip

Current version: 0.6, which has a small bug fix for the posting preview page.

[The link above shows it working, it changes the above long, cut and pasted url, to [link], that's an option]

It's pretty easy to implement, takes maybe 10 minutes or so. This mod does not affect any data in the databases, it only affects the output phase, so nothing internally in your forum will change.

NoFollow Outbound Link Spam Defeat Mod Features
  • Lets you set a minimum post count for allowing links without nofollow.
  • Changes, if you want, long messy urls to [link] or whatever you want to put in there for standard users.
  • Changes new user long, cut and pasted urls to [link] by default.
  • Changes any link text [spammers like putting descriptive link text in their links] from a new user to [new user link]. You can change the text to suite your style and taste. Or you can just let them use link text. But most new users don't tend to use that feature anyway.
  • Creates a new [ url-nf] bb code opening element, that one closes with [/ url] to make it easy to type, [ url-nf=http:.....]some site[/ url] just adds a rel="nofollow" attribute to the <a...> tag, that one is permanent, doesn't depend on the minimum post status. This lets you cutoff questionable links, or link to sites you aren't sure about, or that you don't want to pass any link credit to.
  • For users over the minimum post limit, any link text they had posted while under the limit will reappear, and any new link text will just appear as usual.

The mod puts a nofollow on all new user topic links, user website links, and links in user's signature based on the user post count. Once the post count is greater than the limit, the users signature, www link, and post topics will no longer have the rel="nofollow" in the links.

It also adds the nofollow and link text changes to the posting preview page. See below for thanks on that one.

This is a code only mod, no messing with databases or anything, it's very simple. The minimum post number is hardcoded into bbcode.php.

If you don't want [link] to replace long urls, you can just uncomment the original format in the mod, and comment out the [link] option for $ret.

Warning: this mod is NOT tested for easymod. It may work, I don't know, I haven't tried.
It uses more or less the easy mod format, but it may be slightly off, if you want to try it, let me know if it works. Back up your files first, of course.

The Benefits of this Mod?
I made this because I got sick of forum spammers lurking then posting late at night, to try to get their link spidered and credited before it got edited or deleted.

This takes some of the pressure off you and your mods, now you can take a few days off now and then without worrying too much about getting link spammed and search engines possibly penalizing your pages for linking to scummy websites. These types of spammy websites are known as 'bad neighborhood sites', and you don't want many, if any, outbound links from your forum to those types of sites.

The nofollow attribute stops search engines dead. Most blogs have this option now in their comments section because of the heavy comment link spam they got, but forums still don't have an easy way to do this. This mod hopefully will take some of the pressure off of overworked mods.

Any feedback on the mod is appreciated.

Block members.php, groupcp.php and profile.php in robots.txt
This mod only handles viewtopic.php and posting.php, but that's the main problem area. You can keep search engines out of the other parts where bad links might appear by simply adding these lines to your robots.txt file. Robots.txt is in your site [not forum] root directory, where your index page is, index.html, index.php, or whatever.

If you don't have a robots.txt file already, just create a plain text file in any code editor with this content. Make sure to change /phpBB/ to the name of the folder your phpBB installation is in.

:: Code ::
User-agent: *
Disallow: /phpBB/profile
Disallow: /phpBB/groupcp
Disallow: /phpBB/memberlist

That's the mininum I'd block, this is the list I'd use if I were you. None of these sections need to be seen by search engines, they are just bloat that will bog down the search engine.

:: Code ::
User-agent: *
Disallow: /phpBB/post-
Disallow: /phpBB/posting
Disallow: /phpBB/search
Disallow: /phpBB/updates-topic
Disallow: /phpBB/stop-updates-topic
Disallow: /phpBB/ptopic
Disallow: /phpBB/ntopic
Disallow: /phpBB/profile
Disallow: /phpBB/groupcp
Disallow: /phpBB/login
Disallow: /phpBB/modcp
Disallow: /phpBB/privmsg
Disallow: /phpBB/memberlist
Disallow: /phpBB/mark-forum

Save the file as robots.txt, upload it to your website root directory, and after that search engines won't index or spider those urls any more. None of them have any content, they are just various edit and other forum functions that don't need indexing.
Back to top
Code3TJ
Status: New User - Welcome
Joined: 23 Feb 2006
Posts: 1
Reply Quote
I just installed this due to a bunch of spam we've been getting. I did notice one little thing. If you preview a post like this:
:: Code ::
To use alternate text, type [url= http: //jeephorizons .com]Jeep Horizons[/url] (remove the spaces) to get [url=http://jeephorizons.com]Jeep Horizons[/url]

it displays this:
:: Code ::
To use alternate text, type [url= http: //jeephorizons .com]Jeep Horizons[/url] (remove the spaces) to get [new user link]

in the preview window. Not a big deal by any means.

I have it set right now at 5 posts and I have well over that, so I wouldn't think I'd be a new user. I've checked the code and it looks like I entered everything correctly, but I'll double check. All in all, it looks great. And if you'd like to see a demo, I've [new user link] running.

Thanks much for writing this!
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3922
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Glad it's working for you, the preview thing happens because most of the mod happens in bbcode.php. I'd call that a bug, I actually never noticed that before, I never preview my posts. That's why it's good to have other people check the stuff.

Version 0.6 will have that fixed, just a few lines on posting.php is all that's needed.

This mod really works though, it helps to let the spammers know that they are really and truly wasting their time. And even when they do spam, it will do them no good, the mods can come back at their leisure and clean up the junk.

<added>
Bug fix is in place, requires a few lines change to posting.php as well. Download 0.6 for this fix, or by clicking the link above. Now preview is handled as well, that was a good catch, thank, I'd missed that one.
Back to top
kameel
Status: New User - Welcome
Joined: 25 Mar 2006
Posts: 1
Reply Quote
Hi,

It's working great for me! Thanks for this mod.

I installed it with easymod, smooth :) Thought you'd like the feedback.
Some more feedback: my site uses the 'phpbb_fetch_all' mod at several places. Since this mod also makes calls to the bbencode_second_pass() function, I had to make some modifications to this mod to get my portal pages working properly again.

Ciao, Kameel
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3922
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
kameel, thanks for the feedback. So easy mod worked fine, that's good to know. Glad it's working for you. Hope it helps too.
Back to top
softstag
Status: New User - Welcome
Joined: 20 Jun 2006
Posts: 1
Reply Quote
This looks like a really good mod. Thanks.

I really like the idea of being able to have the nofollow attribute on links from posts by users with a low post count. For me though, I am not interested in the other features this mod has. Can anyone tell me how I can use just the part I want? I don't know much php coding, but I can make the changes if I'm told what to do.

Any help would be much appreciated.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3922
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
softstag, sorry, the mod is what it is, figuring out how to modify it further is upto you.

The link changing stuff is just an option you can comment out if you want. Or you can simply not change it.

Most of the other stuff is equally easy to change if you want to, but you have to understand what's happening, and be able to test it on a test install to work with it. I can't do that, since I wouldn't be running the desired changes.

But if you want to modify it, you're on your own, we won't support any questions you have on that, it's simply not practical, especially if you don't have much php background.
Back to top
phpbb3.x
phpbaby
Status: New User - Welcome
Joined: 06 Sep 2009
Posts: 1
Reply Quote
Hello !
Do you think this could work on phpbb 3 ?
Thanks for this great idea
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 3922
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
no idea, try it and post your results.
Back to top
Display posts from previous:   

All times are GMT - 8 Hours