Example: deny access from some IP addresses .htaccess Print

  • 0

Sometimes it becomes necessary to block access to the site or part of it from certain IP addresses.

In this case, you need to create a .htaccess file with directives in the desired directory. For example, to deny access from IP address 172.12.12.12:


Order Allow,Deny

Allow from All

Deny from 12/172/12/12

 

Now, when trying to access the site from the IP address 172.12.12.12, the visitor will receive a 403 error or your page for this error.

Specifying part of the address in the form 172.12.12 will restrict access from the 172.12.12/24 subnet.


Was this answer helpful?

« Back