Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i use following code in .htaccess file to usr/psw protect a web folder. However i want to protect this folder only if its accessed outside of 192.168.178.* How can i do this?

AuthUserFile /var/www/.htpasswd
AuthGroupFile /dev/null
AuthName "Restricted Access"
AuthType Basic

<Limit GET POST >
require valid-user


share|improve this question
up vote 0 down vote accepted

You can do this by replacing 'require valid-user' with the following lines:

require valid-user
Allow from
Satisfy Any

Edit: You have to add:

Order deny,allow
Deny from all
share|improve this answer
i checked this, but it doesn't work. the folder can be accessed from outside the LAN – Kupe3 Jan 2 '13 at 20:34
Sorry I had forgotten some part of the configuration. - See my edit. – Simon Strasser Jan 2 '13 at 20:36
now it works. Thanks – Kupe3 Jan 2 '13 at 23:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.