Archive for May, 2006

Blocking comment spam with Apache and htaccess

Thursday, May 18th, 2006

I’ve been plagued by comment spam in this weblog for a month or two now, and today I got really tired of deleting 3-4 spam comments every day.

When I investigated the originating IP:s, I noticed that all spam except ONE came from one of four C-nets. I quickly decided to block in the .htaccess file in the weblog directory.

Here’s what I added.

# DIE, SPAMBOTS, DIE!

order allow,deny
deny from 208.66.193
deny from 64.62.22
deny from 81.177.14
deny from 81.177.15
allow from all

I’m willing to take the very small risk that a valid user from one of these IP:s won’t be allowed to enter my weblog.

(Yes, I know that I could install a WordPress plugin, but this was quicker and less cumbersome. )