wwbd – Get your groove on!
Subscribe

Spammers make me grumpy

September 10, 2005 By: bio Category: Geeky Stuff, General

Once again, I’ve been going through my refer spam, trying to makes my stats readable.

There seems to be a trend where sites are hitting your page in the hopes that you publish your stats (which I don’t), so that their link will appear high in the list of referring pages, and they’ll either get a better google rank or some idiot will click on them.

I will not drive business you way, spammer tard.

So… if you run a php based site (ie, a blog, forum, etc), you can end this nonsense by using the No Refer Spam script.

In your index.php, include the following chunk of code at the very top of the file:
< ?php /* redirect for known spammers */ require('/path/to/your/file/no-refer-spam.php'); ?>

Then, download this file, rename it to .php, and place it in the same folder as your index.php. It’s got all the domains I currently block in it.

How it works:
When a site links to you, and passes along a “referrer” (the link it came from), the script looks at the referring link. If it or part of it matches what’s in the no-refer-spam.php file, it redirects that link back to the page it came from (read: they link back to themselves). Since it never actually loaded your page, it won’t show up on your stats.

Spiffy!

How to add/remove sites:
no-refer-spam.php is a comment delimited file. To add, simply place a comma after the last entry, and put in the domain or part of the domain with quotes around it.

Something to watch out for, you can block a lot of things with a partial match. If you have “casino” in there, and some posts a link to you from a page with a link like “http://hisdomain.com/bio-really-hates-casinos.php”, it will be shot right back at the linker. You’ll see in my list, I usually block part of the domain (that’s safer).

Credit:
I didn’t write this. It comes from the creative genius of this guy and was modified by this guy (that’s where I found it).

Comments are closed.