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 in the desired directory .htaccess with directives. 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 error 403 or your page for this error.

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