Recently I have posted several articles describing the use of the .htaccess file.
In this post I will explain how can we limit the access of the website to Local Area Network only.
You can specify the IP range for which you want to allow the access.
You need to place the below code in .htaccess file.
[cc lang=”apache”]
# limit access to local area network only
order deny,allow
deny from all
allow from 192.168.0.0/111
# This will limit the access only from 192.168.0.0 to 192.168.0.111
[/cc]
Code is better to understood.
How do the rules work – when it says deny from all, does it not match all requests including 192… Given my background in ASP.NET, I am curious how it works as the rules are exactly the opposite in ASP.NET. Also is it possible to use NTLM based authentication with Apache in a Windows environment.
Yes first we have declared that “deny from all” and then after we have also declared the “allow from 192.168.0.0/111”,
How to assign permission is based on this sentence “order deny,allow”.
Nice that will be useful to keep some docs secured.
Thanks Luke…