How To Avoid Spam Comments on WordPress Using .htaccess method

Avoid Spam Comments

One of the biggest challenge which you will face while running a blog is combating spam in various form. One of the most common form of spam is comment spam and when it comes to WordPress we have various ways to battle comment spam. One of the best way is by using Akismet WordPress plugin and you can watch below embedded  video (Direct link ) to learn how to use the plugin.

You can get the Akismet WordPress plugin from here and check this guide to learn how to get free API key for Akismet plugin.

Though at times if you will see your comment spam page, you might find few IP’s are constantly sending comment spam. The easiest way to get rid of these spam is by blocking their IP address using .htaccess method. I highly recommend keeping a backup of your .htaccess file before editing it. .Htaccess file is located at the root of your WordPress installation and you can either use SEO by yoast plugin > Edit files to edit your .htaccess file or you can follow this guide which I have mentioned below to make changes in your .htaccess file. Make sure you take a backup of your .htaccess file before making changes, as even a single wrong character will  make your site inaccessible.

Here is the code that you need to enter in your .htaccess file, and upload it.

<Limit GET POST>
order allow,deny
deny from
allow from all

You can always enter more IP’s by adding one more line

deny from

You can get the IP of the spammer in your spam comment page, under WordPress dashboard I find this way to be the best way to fight against the lots of spam from bots. Here is one post which I recommend to every WordPress blogger to read regarding comment moderation on their blog:

Subscribe on Youtube

Article By
Harsh Agrawal is a blog scientist and a passionate blogger. He is blogging since 2008 & writes about Blogging, SEO, Make money online & tech. His blog, ShoutMeLoud receives 1 million Pageviews/month and have over 700K subscribers.