How to restrict IP access to an Apache directory using an .htaccess file?


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » Apache Related Information

How to restrict IP access to an Apache directory using an .htaccess file?Last Modified: Jul 11, 2013, 3:27 pm
If you have a path with sensitive data that you don't want to be public, you can restrict the path to only be accessible by your own IP address, using an .htaccess file.

Create the .htaccess file in the path you'd like to protect.
Add this code, where you'd replace 1.2.3.4 with your own IP.

<Limit GET POST>
       order deny,allow
       deny from all
       allow from 1.2.3.4
</Limit>
<Limit PUT DELETE>
       order deny,allow
       deny from all
</Limit>

Other variations on this are possible, google should have many guides on it.

2003 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST