How to protect your blog from spam bouts with out using any plugin

From a couple of days my blog is getting a lot of comments which are irrelevant to the content. I came to know that these comments are being generated automatically using some autopilots and spam bots. And then I started search on this issue and came across many plugins. Each and every plugin has their own strategy in preventing the comment spam. And I don’t want to use plugins for this simple issue because I know that using a lot plugins may slow down my blog loading time. Then one of my friend told me that we can prevent these spam bots using the htaccess file in the root directory then I search for the code which can help my blog from the spam and came across many scripts. I came to know that by preventing wp-comment-post.php file I can redirect the spam bots and make them not spamming my posts via use less comments.


We can do this my placing few lines in our htaccess file and the code comes here

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*yourdomainname.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]

By using this code in your htaccess file you can protect your wp-comments-post.php file from the spamming bots. Before using the code take backup of your old code, if any thing goes wrong it will helps you. Don’t forget to replace your domain name in the above code.

By using this this code you can reduce your spam comments which is coming from autopilots and spam bots.

Which method are you using in your wordpress blog to protect from spam, Plugin or just monitoring with htaccess file ??