type="text/css" />

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 Jinnat Ul Hasan | 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:

  • how to stop unwanted users getting on to wordpress site
  • how to ban users from wordpress
  • blocking unwanted bot htaccess
  • how to deny ip in .htaccess +cpanel
  • bots undesired comments
  • 123.456.789
  • wordpress banning users
  • .htaccess allow bots
  • a bot file that ban users
  • using .htaccess to stop unwanted bots

Previous post:

Next post: