Related Items  

Linux and Windows Support  

make-it-great-again

Login or Register  

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

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

PrintE-mail

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 192.168.5.10
Allow from 192.168.10.10
Allow from 10.10.10.3
Satisfy Any
</Location>

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

Add your comment

Your name:
Subject:
Comment:
  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
-->