Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save daubac402/df0203f6ffc204eff3739c16e5d4a7b3 to your computer and use it in GitHub Desktop.
Save daubac402/df0203f6ffc204eff3739c16e5d4a7b3 to your computer and use it in GitHub Desktop.
.htaccess - Require basic authen for specific path
# Condition
SetEnvIf Request_URI ^/your_secure_path auth=1
# Basic Authen
AuthName "Basic Auth"
AuthType Basic
AuthUserFile "/path/to/my/.htpasswd"
# first, allow everybody
Order Allow,Deny
Satisfy any
Allow from all
Require valid-user
# then, deny only if required
Deny from env=auth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment