Thursday, February 3, 2005

Prevent spam referrers


I have been noticing that there have been spammers that have been trying to get higher rankings on search engines by sending "referrer spam" to my site. They are sending HTTP requests with referrers from the domains that that they are trying to increase the rankings of. (To me this seems pointless, because I don't display the referrers anyplace that search engines can see.)


I just saw an entry on this pLog bug report, that mentioned a potential solution to this. Put the rewrite rules in your configuration:


RewriteEngine On

RewriteCond %{HTTP_REFERER} ^http://.*(loans|poker|casino|psxtreme|strip|diet|pills|learnhowtoplay|freakycheats|viagra).* [NC]

RewriteRule \.*$ http://www.freakycheats.com [R,L]


This will cause any requests that have any of those keywords in their referrers, to be redirected to one of the spamming addresses.