Skip to content

Instantly share code, notes, and snippets.

@emarthinsen
emarthinsen / .htaccess
Created June 9, 2018 21:29
.htaccess - take 2
# These two statements will correctly set REQUIRE_AUTH to 1 or nothing
SetEnvIfNoCase HOST staging REQUIRE_AUTH
SetEnvIfNoCase Request_URI ^/privacy-policy$ !REQUIRE_AUTH
AuthType Basic
AuthName "Staging Area"
AuthUserFile /var/app/current/public/.htpasswd
Require valid-user
Order Allow,Deny
@emarthinsen
emarthinsen / .htaccess
Created June 9, 2018 22:50
.htaccess - take 3
# Set the REQUIRE_AUTH environment variable if we should password protect
SetEnv NO_AUTH 1
SetEnvIfNoCase HOST staging !NO_AUTH
SetEnvIfNoCase Request_URI ^/privacy-policy$ NO_AUTH
RewriteRule ^ https://www.google.com$%{ENV:NO_AUTH} [L,R=302]
# Define the basic auth setup
AuthType Basic
AuthName "Staging Area"
AuthUserFile /var/app/current/public/.htpasswd