Hello once again. In this article I wanted to talk about comment spammers. Like email spam, comment spammers use software to trawl the internet for comment fields in blogs and forums etc and then automatically enter multiple comments and flood your system with stupid, useless comments.
I describe them as stupid and useless comments not just because they are unwanted, but also for a couple of other reasons. Firstly no sensible person is going to allow comments to go straight through to their blog. Not so much to censor legitimate comments but specifically to cut out off topic, unrelated comments or spam. Secondly, the spam comments are often just nonsense jumbled letters, and the urls are invalid addresses that don’t lead any where, so they are not even promoting themselves. So they don’t actually achieve anything for any one. I have never understood why spammers would go to such effort for no reason. But regardless, the fact of the matter is they do go to such efforts and I wanted to describe how to block them here.
The last time I cleared out my spam comments was the 4th of September. Today is the 23rd of September and I had 681 more waiting for moderation (aka deletion).
In order to block comments spammers we first of all need their IP addresses. I use WordPress as the software behind my blog and WordPress fortunately records the IP addresses of all comments. The easiest way of sorting through all the IP addresses from the comment spam is to copy all the comments (plus their IP addresses) into excel. It is a little bit tedious when there are lots of them but excel lets you easily sort all the IP address such that the ones that are the same all bunch together.
I have a screen shot of my excel spread sheet here to show you what I mean.
When I had copied all the spam comments into excel I noticed that there were actually some legitimate comments amongst all the spam so I highlighted them in yellow to remind me to go through and allow them to post before I delete all the spam. My appologies to any actual visitors for the delay in allowing your comments to post, as I say I had missed your comments amongst the spam.
So now you have all the IP addresses sorted you can see where the worst of the spam is coming from.
Now how to actually block those ip addresses so they can’t access your site and therefore post comments to your pages I will get to in a sec. I just wanted to mention first that if you are interested you can see where all the spam is coming from. There are IP address locator search engines around the web (e.g. http://www.ipaddresslocator.org/ip-address-location). If you enter the ip addresses you have collected from your spam comments you can see the location of the server that is sending it. It probably doesn’t help much but it at least gives you a location to direct your anger towards.
As for how to block theseIP addresses. There is an excellent description of how to to this here (http://www.websecurity.mobi/computer-security/694-how-do-i-block-ip-address-accessing-my-web-site.html).
Briefly in the root directory of your web site include a file called .htaccess
In this file include the text:
Order Deny,Allow
allow from all
deny from 200.63.42.136
deny from 121.114.170.147
These are just a couple of the IP addresses that I am currently blocking. You can include as many as you want. As described on the how to web site above you can also block particular domains or IP address ranges.
When you do this you will be blissfully free from spam commenters…until some more find your site, but at least you won’t have to keep getting rid of hundreds of spam comments. I hope this helps a little.