Trying a new approach to blocking IPs

by Sapphire (August 4, 2007)

ETA: this method for blocking referral spammers may have caused my site some problems. Read about it here.

The approach of blocking IPs to keep out the barrage of referral spammers hitting some of my sites lately had mixed results. So I found another method which I’m trying. It looks foolproof, but I’ll report in a day or two how it worked out for me. Basically, you add some redirect code into your htaccess and send them off to another site. This is the code I’m using, complete with the actual sites I’m blocking.

# Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www\.)?ground-level.org.uk.*$ [OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?weblog.eos.net.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?www.manywaystopeace.org.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?sogamble.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?lotinsure.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?gidguide.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?upgamble.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?tenguide.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?xoquote.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?rdidweb.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?nipguide.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?gamblelo.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?xoquote.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?asgamble.com.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?insurelly.com.*$ [NC]
RewriteRule .* - [F,L]

You can add or subtract as many sites as you want, but make sure the first site has [OR] after it, the middle ones have [NC,OR] after them and the last one has [NC]. The final line - RewriteRule - is redirecting the spam site to a “forbidden” error page. There’s another option: you can redirect it to some other website by replacing the final line with code like this:

RewriteRule \.*$ http://dontbeanidiot.org[R,L]

I chose DontBeAnIdiot.Org because it’s designed for you to send people who are being idiots there. But I personally would be very cautious about redirecting spammers to anywhere just because then they’re wasting someone else’s bandwidth. The “Forbidden” error page is more what I want.

I’ll know tomorrow if this is working.

Your Ad Here


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Comments will be sent to the moderation queue.