Created
March 27, 2013 03:45
-
-
Save cafuego/5251442 to your computer and use it in GitHub Desktop.
conditional auth_basic based on hostname
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set password authentication on nominated hostname via the | |
# setenvif module. | |
<IfModule mod_setenvif.c> | |
AuthType Basic | |
AuthName "Enter a damn password you monkey" | |
AuthUserFile /some/htpasswd | |
Require valid-user | |
SetEnvIf Host .*\.example\.com$ NEED_AUTH | |
SetEnvIf Host .*\.example2\.com$ NEED_AUTH | |
SetEnvIf Request_URI ^/special/public-path/ !NEED_AUTH | |
Order Allow,Deny | |
Allow from all | |
Deny from env=NEED_AUTH | |
Satisfy any | |
</Ifmodule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment