spam yourself
Oct 02, 2004, 03:01am EDT
I’ve been getting a lot of referrer spam recently. This seems to happen to a lot of people and there are lots of solutions, most of which involve creating a black list of offending sites. Since I don’t want to actually maintain a black list, my solution is a bit different.
I’m also using mod_rewrite to identify referrer spam and handle it. Except I noticed a pattern in the spam I got, lots of the spam tried to load non-existent pages on my site and generated 404 errors. Specifically, if the referral site was http://spamming-site.com, it would try to load http://aypwip.org/spamming-site.com. This makes it easy to block all request sites that end in .net or .com. So my RewriteCond looks like this:
RewriteCond %{REQUEST_FILENAME} !-f # and it’s not a file
RewriteCond %{REQUEST_FILENAME} !-d # and it’s not a directory
Next, I took Ed Costello’s approach and rather than returning a 403 Forbidden, I redirect the request back to the spammer’s site.
RewriteRule ^(.*)$ %1 [R=301,L] # 301 Moved
That should keep my logs clear for a while.
DC at Oct 02, 2004, 01:17pm EDT
That is pretty weird. Why would you get those at all?
tony at Oct 02, 2004, 02:44pm EDT
I think it’s done as an attempt to increase search engine ranking. The hope being that the site you spam publishes a referrer list so a link back to the original site exists.
Professor Johnson’s blog is an example of a site that show referrers, so it would be a good site to spam (although they probably have some countermeasure also).
On a side note, my usage stats shouldn’t matter; it’s in my robots.txt file.