Forked from tomschlick/Environments to bypass .htpasswd protection
Created
May 9, 2019 11:41
-
-
Save garyconstable/2a26f2b8342b943ac4e8f78c7589d2ea to your computer and use it in GitHub Desktop.
This allows you to set certain urls/domains that are allowed to bypass a htpasswd protection layer, which is very useful for multiple environment setups (developement, staging, production)
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
#allows a single uri through the .htaccess password protection | |
SetEnvIf Request_URI "/testing_uri$" test_uri | |
#allows everything if its on a certain host | |
SetEnvIf HOST "^testing.yoursite.com" testing_url | |
SetEnvIf HOST "^yoursite.com" live_url | |
Order Deny,Allow | |
AuthName "Restricted Area" | |
AuthType Basic | |
AuthUserFile /path/to/your/.htpasswd | |
AuthGroupFile / | |
Require valid-user | |
#Allow valid-user | |
Deny from all | |
Allow from env=test_uri | |
Allow from env=testing_url | |
Allow from env=live_url | |
Satisfy any |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment