Related Items  

Linux and Windows IT Support  

dedicated-technology-experts

Windows, Apple and Linux IT support and services.

For Software and Web Development.

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 - 2024 Virtual Helpme | Business IT Support | Original Template: Allrounder