How To Stop Spam Comments on WordPress Using .htaccess File

Get Thrive Leads for WordPress

One of the biggest challenges which you face running a blog is fighting spam of various type. One of the most common types of spam is comment spam and when it comes to WordPress  Blog we have many ways to fight comment spam and spammer. One of the best ways is by using Akismet WordPress plugin by WordPress itself.

Avoid-Spam-Comments

You can get the Akismet WordPress plugin from here and learn how to get free API key for Akismet plugin on the same website.

So,  at the same times when 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 comments is by blocking their IP address using .htaccess file 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 Directory 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 any changes, as even a single wrong character will make your site inaccessible and you may not able to live your web site for a while if you are not technical. That is why I am saying to keep a backup first before any editing in the .htaccess file.

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

<Limit GET POST>

order allow, deny

deny from 88.146.119.120

allow from all

</Limit>

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

deny from xx.xxx.xxx.xxx

You can get the IP of the spammer in your spam comment page, under WordPress Login dashboard I find this way to be the best way to fight against the lots of spam from bots.

Hope this will help you to fight with spam for more tutorials and tricks don’t forget to subscribe us.

Sharing is Caring!
shamsher khan
 

Digital Marketing Trainer, Consultant and a Professional Blogger having more than 6 years of experience.  Let's meet over a coffee and discuss if you want to grow your business online or want to learn digital marketing.

error: Content is protected !!