.htaccess IP Blacklist

Tuesday, September 4, 2007 at 6:12:21 PM

've not yet implemented anything in the way of blocking spambots on this site, and recently I got my first taste of comment spam. Luckily it was only one bot and a few comments, which were easily deleted, but after taking a look at my access logs I've noticed that the bot's still there, and has been trying to post to various pages for several days.

In all instances the bot had the same IP, so I toyed with the idea of having my comment posting function check the IP against a database table of known bad IPs, but that seemed a bit overkill for one bad bot. It also wouldn't do much for stolen bandwidth, CPU usage, etc. So I decided to ban the IP entirely in my .htaccess file:

# Block spammers by IP
Order Allow,Deny
Deny from 195.225.177.136
Allow from all


Now if I get a few more bad apples I can just toss their IP in as well. If it gets too large I'll work up an alternative.

Recent Posts


Tags



Archives