Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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
</Limit>

Thanks

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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

require valid-user
Allow from 192.168.178.0/24
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

 
discard

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.