Example: blocking access from some IP addresses


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


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


Order Allow,Deny
Allow from All
Deny from 172.16.16.16

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


Specifying part of the address as 172.16.16 will restrict access from the subnet 172.16.16/24.