The scourge of referrer spam

If you keep track of referrers to your website, no doubt you have come across this problem.

Referrer spam is most notable in the weblogging community. An automated program, also called a Bot, will spoof its referrer when it visits your site. If you have referrer tracking software installed, like Refer or Bbclone, this referrer will register a link to the spoofed site in order to advertise that site on yours, and boost the site’s ranking in the Google search engine.

This whole practice is based on the notion that you are:

  • Stupid, or
  • Have never received referrer spam before, or
  • Still don’t know how to spot spam, or
  • Keep your refer app out in the open, ready for google to index it.

The problem is, My BBclone install is behind a closed door and after a year of this nonsense I can spot referrer spam from miles away. (please, you really want me to click that!).

The last few weeks have been a total referrer spam nightmare. I’m constantly being hit by these ridiculous poker uri’s, which led met to search for some draconian measures. Hurray, I found them!

The .htaccess-file on apache servers serves many purposes, for one example, it takes care of the nice uri’s for the news. Another thing it can do is block specific referrals.

If you paste the following script in your .htaccess-file, your Apache webserver will simply send the spamBot a 403-Forbidden HTTP header instead of the page, thus it bounces off.

# Block access with these referrals
RewriteCond %%{HTTP_REFERER} (free-texas-hold-em-best-deals\.com) [NC,OR]
RewriteCond %%{HTTP_REFERER} ( [NC,OR]
RewriteCond %%{HTTP_REFERER} ^(.*)poker(.*)$ [NC]

RewriteRule .* - [F,L]

OR means there will be another line coming, so the last line doesn’t need the OR bit. NC means “ignore the case”, so if the spamBot uses uppercase characters, it will count it as the same spammer. The last rule is the actual action, it processes the conditions and denies the referrers access.

Since a large portion of my spam involved sites with poker in the name, I added a rule killing all referers that had the word “poker” anywhere in the line.

It seems this bit of tinkering stopped the assault dead in it’s tracks. Unfortunately I will have to keep adding keywords and domainnames, but at least this hardline approach will minimise my suffering. I really wish these people got a clue and started doing some real marketing.