Created
September 1, 2016 04:03
-
-
Save yudaprawira/c3203a82b366c219eb6c1da4ad89b19c to your computer and use it in GitHub Desktop.
htaccess protect pretty url with password
This file contains 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
# Do the regex check against the URI here, if match, set the "require_auth" var | |
SetEnvIf Request_URI ^/admin require_auth=true | |
# Auth stuff | |
AuthUserFile /home/juarain/.htpasswds/admin/.htpasswd | |
AuthName "Password Protected" | |
AuthType Basic | |
# Setup a deny/allow | |
Order Deny,Allow | |
# Deny from everyone | |
Deny from all | |
# except if either of these are satisfied | |
Satisfy any | |
# 1. a valid authenticated user | |
Require valid-user | |
# or 2. the "require_auth" var is NOT set | |
Allow from env=!require_auth |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment