Home WordPress WordPress: How to block spam comments using .htaccess file

WordPress: How to block spam comments using .htaccess file

by Satish Kumar
WordPress How to block spam comments using htaccess file

Combating spam is the more challenging job for bloggers, and most common are spam comment. Nowadays, we can block comment spam by the various way.

The best ways are to block spam comments by WordPress plugins like Akismet or WordPress security firewall. By using these plugin, you can set the spam block parameters.

Akismet plugin is the best plugin to avoid comment spammer and it performs well.

You can download these plugins from below links:

Link:  WordPress Akismet Plugin

Link: WordPress Security Plugin

There are two techniques to block to spammer for your blog:

  1. By analyse the behaviour

  2. By using the IP

Most of the time we get the spammer IP at spam comments page, and you can check what are the IPs always or periodically sending spam comments. So, you can block these spammers by using IPs block techniques. For this configuration, you no need to use any firewall kinds of thing you can block those IPs by using “.htaccess” file also.

I recommend you to always keep a backup file before start editing. The “.htaccess” file, you can find it in the root directory where wordPress is Installed, you can use either any of the editor (i.e., notepad, notepad++, vi, vim etc) to edit this file or use Yoast’s SEO plugins to edit “.htaccess” file.

To edit the “.htaccess” file you can use this code to the file:

<Limit GET POST>

Order allow, deny

Deny from  11.11.11.11

Allow from all

</Limit>

If you have more than one IP you can use that IPs by adding another command

Deny from ZZZ.ZZZ.ZZZ.ZZZ

To find the spammer IP you can refer comment spam page, at your WordPress admin panel. I am always blocking spammer by using same techniques.

You can share your experience of blocking spammers for your blog by commenting here.

Feel free to leave your own opinion, and any extra tips and ideas are always much appreciated.

Don’t forget to subscribe to GUTANN email newsletter to keep updating yourself with such posts in future.

Dear learners if you need any help for your blog, you can get the suggestion by commenting below or contact me by using the contact form.

You may also like

Leave a Comment

twelve + 2 =