How To Avoid Spam Comments on WordPress Using .htaccess method

IN WordPress

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

Click to activate Offer & visit site Discount added automatically
No related entires

Subscribe to SML Newsletter

Receive Blogging Tips & Strategies

Get WordPress Guide eBook for free in the 2nd newsletter

100% privacy. we will never spam you

  • Author Bio

  • Latest Post

Blog post by Harsh Agrawal

Harsh has written 1051 articles.

Follow ShoutMeLoud on Twitter. Subscribe to ShoutMeLoud feed via RSS or EMAIL to receive instant updates.

Send Us Inquiry


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>