Skip to content

Instantly share code, notes, and snippets.

@Digi92
Created February 22, 2021 18:22
Show Gist options
  • Save Digi92/39617c18f32c5921425c19d1f8adb21c to your computer and use it in GitHub Desktop.
Save Digi92/39617c18f32c5921425c19d1f8adb21c to your computer and use it in GitHub Desktop.
AuthName "Protected Area"
AuthType Basic
AuthUserFile /path/to/your/.htpasswd
AuthGroupFile /dev/null
SetEnvIf Request_URI .* noauth
SetEnvIf Request_URI the_uri_you_want_to_protect !noauth
SetEnvIf Request_URI /another/uri/ !noauth
SetEnvIf Request_URI add_as_many_as_you_want !noauth
<IfModule mod_authz_core.c>
<RequireAny>
Require env noauth
Require valid-user
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
Order Deny,Allow
Deny from all
Satisfy any
Require valid-user
Allow from env=noauth
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment