Using .htaccess file to block IP addresses Print

  • 0

Create the .htaccess file in your domain's directory. Add the following to your .htaccess file: 

Order Allow,Deny
Deny from 192.0.2.255
Deny from 192.0.12.
Allow from all

Add a Deny line for every user/IP you wish to block. You may add/remove as many Deny lines as you need. You will need to change the IP 192.0.2.255 to the IP or hostname of the user you wish to block. The 192.0.12. means that it will block all IPs in 192.0.12.0 to 192.0.12.255 range.

Was this answer helpful?

« Back