Created
October 9, 2017 19:29
-
-
Save ivcreative/99ca9cb4b24325809333e2b4fd3cccb2 to your computer and use it in GitHub Desktop.
htaccess for Staging protection
This file contains 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
# ---------------------------------------------------------------------- | |
# 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 staging.domain.com 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment