Posts Tagged ‘spam’

How to Block Spam On a WordPress Blog

// July 3rd, 2010 // No Comments » // WordPress Tips & Tricks

My blogs are regularly spammed by the same bots and I wanted to know how to automatically block spam on a WordPress blog. I’ve already mentioned using Askimet as a spam blocking plugin but Askimet doesn’t block IP addresses of repeat spammers. Luckily, I found a spam blocking solution for WordPress among some of the excellent security tweaks in this article on Smashing Magazine.  This snippet of code entered into your .htaccess file will ban persistent spam bots from your blog:

Paste the following code in your .htaccess file, located at the root of your WordPress installation. As I said, always back up the .htaccess file before editing it. Also, don’t forget to change 123.456.789 to the IP address you want to ban.

<Limit GET POST PUT>
order allow,deny
allow from all
deny from 123.456.789
</LIMIT>

There’s almost nothing more annoying than having to clear out the same spam comments from the same IP address every day. Repeat line 4 on a new line with another address and you can block as many spam-happy bots as you like.