Restrict Web Access to Directory

If you would like to restrict access to a specific directory on your linux website you can create an .htaccess file within the directory with the following text:

Order Deny,Allow
Deny from all
Allow from 100.100.100.100

You will need to replace "100.100.100.100" with the ip you would like to have access to the directory. If your IP is dynamic, but within a specified range you can set it to something like 100.100. If you would like to add additional IPs you can do that with another Allow from line.

  • 40 Users Found This Useful
Was this answer helpful?

Related Articles

Password Protected Directories

You can either do it the old school way using .htpasswd or by using the Password-Protected...