
This is a simple quick tool to protect any given directory of your choice by limiting the users viewing and accessing the folder by specifying the IP addresses that can only access it in .htaccess
1. Open your text editor, copy and paste the following code:
AuthUserFile /dev/null AuthGroupFile /dev/null AuthName "Example Access Control" AuthType Basic <LIMIT GET> order deny,allow deny from all allow from 192.168.0.0 allow from 123.4.56.78 allow from 125.5.68.72 allow from 125.5.68.73 allow from 202.138.133.242 </LIMIT>
2. Replace the “allow from” lines to IP addresses that can access the folder/directory. These lines can only be one or can be many as you need.
3. Save the file as .htaccess
4. Upload to the root of the directory that you are trying to protect.













1 Response to IP address restrictions to protect directories using .htaccess
Lucifer Dreams
July 24th, 2011 at 3:38 am
Would you also want to protect the htaccess file with the following?
order allow,deny
deny from all
Or some included form with what you have above. Thanks also for the info.