Created
March 31, 2015 09:07
-
-
Save martijngastkemper/081e6fd3f591cca71681 to your computer and use it in GitHub Desktop.
Use basic auth in combination with mod_rewrite. Source: http://stackoverflow.com/questions/12203989/htaccess-mod-rewrite-and-basic-authentication/29364315
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
| SetEnvIfNoCase Request_URI ^/protected-page-1 require_auth | |
| SetEnvIfNoCase Request_URI ^/protected-page-2 require_auth | |
| AuthName "Login" | |
| AuthUserFile path/to/.htpasswd | |
| AuthType Basic | |
| Order Deny,Allow | |
| Deny from all | |
| Satisfy any | |
| Require valid-user | |
| Allow from env=!require_auth | |
| ErrorDocument 401 "<html><head><meta http-equiv="refresh" content="0; url=/unauthenticated" /></head><body></body></html>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment