Related Items  

Linux and Windows Support  


Login or Register  

If you wish to contribute an article, please login or register.

Ask for a password, unless from specified IP (Apache)


Q. When accessing a directory in apache, I would like to set up a way to ask for a password from a user if he is not listed on the allowed IP list.

A. This one is a bit of a pain to figure out, so here it is:

<Location />
Order Deny,Allow
Deny from all
AuthType Basic
AuthName "Access Restricted"
AuthUserFile "/var/www/.htpass" #your password file
Require valid-user
Allow from
Allow from
Allow from
Satisfy Any

The key here is "Satisfy Any" - only one condition needs to be true.

Add your comment

Your name:
  The word for verification. Lowercase letters only with no spaces.
Word verification:
yvComment v.1.24.0
Copyright © 1999 - 2017 Virtual Helpme | Techical Support and Maintenance | Original Template: Allrounder