How to block certain IP address from accessing your website

To block certain IP address from accessing your website, just create a file with name ".htaccess" at your root directory with the content below:-

order allow,deny
deny from 192.168.0.1
allow from all

If you want to block multiple IP address using ".htaccess" simply add one IP address per line as below:-

order allow,deny
deny from 192.168.0.2
deny from 192.168.0.3
deny from 192.168.0.4
allow from all

You can even block a network range IP using ".htaccess":-

order allow,deny
deny from 129.0.0
allow from all

Thank you.

Comments

Popular posts from this blog

SVN: File remains in conflict

HowTo: Enable extended logging for exim

12 tweakings for WHM/cPanel to speed up WordPress