PDA

View Full Version : allow localhost/ip-address and deny all with htaccess


eloi_egon
11-24-2002, 11:31 PM
I've been looking around the net for an answer but can't find it. This my question:

Is it possible with a .htaccess-file to deny all (only access through a username/password) and to allow (without username/password) my ip-address (or localhost)??


To be specific only addresses 127.0.0.1 and 213.xx.x.x may have access without entering a username/password-combination

Mouldy_Goat
11-27-2002, 01:50 AM
Hi eloi,

This is possible in .htaccess: try taking a look at this (http://home.golden.net/htaccess.html) page which seems to explain how to do this quite nicely. (I just looked up ".htaccess ip address" in Google in case you're wondering how I found this)

So here you'd probably want to do something like:
AuthUserFile /usr/home/eloi/htpasswd
AuthName "Password Protected Area"
AuthType Basic
<Limit GET POST>
order deny,allow
deny from all
allow from 127.0.0.1
allow from 213.xx.xx.xx
require valid-user
</Limit>

Hope that helps

eloi_egon
11-27-2002, 08:50 AM
Thank you!