oncode
9/10/2015 - 8:52 AM

Protect website with .htaccess/.htpasswd based on host.

Protect website with .htaccess/.htpasswd based on host.

# generate with http://www.htaccesstools.com/htpasswd-generator/
admin:$apr1$NT8DsQ2H$3TrWe9hz4TH9b7Qwj5k0H0
SetEnvIfNoCase Host dev\.example\.com nopassreq
SetEnvIfNoCase Host dev\.example2\.com nopassreq

AuthType Basic
AuthName "Testarea"
AuthUserFile .htpasswd
Require valid-user

Order allow,deny
Allow from env=nopassreq
Satisfy any