How to ban undesired users and bots using .htaccess file in WordPress?


This is as true online as it is in real life: someone who pesters you today will probably pester you again tomorrow. Have you noticed how many spam bots return to your blog 10 times a day to post their annoying comments? The solution to this problem is quite simple: forbid them access to your blog.

Paste the following code in your .htaccess file, located at the root of your WordPress installation. As I said, always back up the .htaccess file before editing it. Also, don’t forget to change 123.456.789 to the IP address you want to ban.

1
2
3
4
5
<Limit GET POST PUT>
order allow,deny
allow from all
deny from 123.456.789
</LIMIT>

Apache is powerful and can easily be used to ban undesirable people and bots from your website. With this code, we’re telling Apache that everyone is allowed to visit our blog except the person with the IP address 123.456.789.

To ban more people, simply repeat line 4 of this code on a new line, using another IP address, as shown below:

1
2
3
4
5
6
7
8
<Limit GET POST PUT>
order allow,deny
allow from all
deny from 123.456.789
deny from 93.121.788
deny from 223.956.789
deny from 128.456.780
</LIMIT>

By | On Tuesday, July 13th, 2010 | Under How To's, Security | 2 Comments »


DO YOU NEED OUR HELP?

Contact our experts, most of the time we assist our readers free of charge.

Those who found this page were searching for:

  • ban user wordpress site
  • a bot file that ban users
  • prevent spam bot wordpress cpanel
  • wordpress wp-ban htaccess
  • wordpress ban users
  • htaccess to block spam bots
  • cpanel deny ip htaccess
  • using .htaccess to stop unwanted bots
  • cpanel block bots
  • allow bots .htaccess
  • Ria

    People who find editing .htaccess to be critical can also do this very easily from cPanel IP Deny Manager section. cPanel will then make the .htaccess with the same info above.

Previous post:

Next post: