Skip to content

Instantly share code, notes, and snippets.

@martijngastkemper
Created March 31, 2015 09:07
Show Gist options
  • Select an option

  • Save martijngastkemper/081e6fd3f591cca71681 to your computer and use it in GitHub Desktop.

Select an option

Save martijngastkemper/081e6fd3f591cca71681 to your computer and use it in GitHub Desktop.
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