Skip to content

Instantly share code, notes, and snippets.

Created March 4, 2012 17:33
  • Star 40 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
htaccess to password protect a specific server
# ----------------------------------------------------------------------
# Password protect staging server
# Use one .htaccess file across multiple environments
# (e.g. local, dev, staging, production)
# but only password protect a specific environment.
# ----------------------------------------------------------------------
SetEnvIf Host passreq
AuthType Basic
AuthName "Password Required"
AuthUserFile /full/path/to/.htpasswd
Require valid-user
Order allow,deny
Allow from all
Deny from env=passreq
Satisfy any
Copy link

I think @jan-vodila and @loekwetzels are right. Probably not a good solution for anything seriously important

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment