View Full Version : htaccess allow ip-range and users

10-27-2004, 01:37 PM
Hi, I've been looking for a script for htaccess but I could only find pieces. I don't know if it can be combined.
this is what I want to accomplish:
I want to allow access from the ip-range 134.xxx.xxx.xxx and request authentication if the visitor is outside this range.

I can use this code to request authentication:

AuthName "Restricted area"
AuthType Basic
AuthUserFile /full/path/to/.htpasswd
Require valid-user

and something like this to allow the ip-range 134.xxx.xxx.xxx:

order allow,deny
allow from 134
deny from all

any body knows how I can combine this?


11-07-2004, 08:00 PM
Never tried this, but I think you need the Satisfy directive.

Order Deny,Allow
Deny from all
Allow from 134.
AuthType Basic
AuthUserFile /full/path/to/.htpasswd
AuthName "Restricted Area"
Require valid-user
Satisfy any

This should allow users from the 134. Ip range and request authentication from other users.

For more info, see the Apache Core features: