Categories
Uncategorized @et

Know how to stop spam comments count without using wordpress plugin

A spammer usually access your ‘wp-comments-post.php’ file directly to put comments and it has been observed that most spammer’s doesn’t have any referral value in HTTP_REFERER.

We all love to have lots of comment on our article as it give a feel of satisfaction and pride that people liking our article but it become a source of irritation when you start getting “Spam Comments” more than “Genuine Comments”.

I know you are thinking that I must be a newbie in blogging who doesn’t know about ‘Akismet’, that help you to filter out your spam comments and you can easily delete them all in one go.

But wait….

Why I don’t believe on Akismet

It is correct that ‘Akismet’ filter out comments and put them in spam folder but if you have analyzed them closely you will notice that most of the time it put some “Genuine Comments” into spam folder.

So If you are getting 500 spam comments daily and you are using ‘Akismet’ then you have to go through your each spam comment once before deleting to check whether it’s a “Genuine comment” from your reader or not.

Recently one of my fellow bloggers informed me about it, “He said that whenever I comment on his blog, it went into spam folder”.

In my opinion ‘Akismet’ is just putting spam comment (with some genuine valid comments) into spam folder, it is not stopping spam comments to be enter in your blog.

Why not Captcha

I am not against using ‘captcha’ plugin to reduce spam comment but it has two draw backs.

  1. It’s a plugin with image processing so it increase the load time of your page.
  2. User find filling ‘captcha’ more irritating job (they prefer not to comment most of the time).

Tricks to stop Spam Comments

I have done some analysis on how spammer put comments on your blog. Most of the spam comment that ‘Akismet’ put into spam folder came from Auto Spam software or scripts.

You can see this easily that same comment from different keyword and different IP address in your spam folder.

A spammer usually access your wp-comments-post.php file directly to put comments and it has been observed that most spammer’s doesn’t have any referral value in HTTP_REFERER.

You can easily catch such spammer by putting below code into your ‘.htaccess’ file.

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteCond %{REQUEST_METHOD} POST

RewriteCond %{REQUEST_URI} .wp-comments-post.php*

RewriteCond %{HTTP_REFERER} !.*yourdomain.com.* [OR]

RewriteCond %{HTTP_USER_AGENT} ^$

RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]

</IfModule>

Note:

  1. Before making any change take the backup of your ‘.htaccess’ file.
  2. In above code ‘yourdomain.com’ must be replaced with your own domain name.

Above code just check that whether any request to ‘wp-comments-post.php’ file is having value in ‘HTTP_REFERER’ or not. If it doesn’t have any value then it won’t allow to access file.

I have implemented the above code on my blog around 10 days back (from the date of publishing this article) and it has reduced the spam count around 95% (5% are manual spam).

It is not stopping any of reader to make comment manually. It is not stopping any other search engine bot to access my pages for crawling (No issue reported in webmaster tool). So the above method is 100% tested and safe to use.

I know that still there are ways that spammer can use to put spam comments, but it is really easy to find one valid comment among 10 spam comment instead of finding one valid comment among 100 spam comment.