Protect website with .htaccess/.htpasswd based on host.
# generate with http://www.htaccesstools.com/htpasswd-generator/
admin:$apr1$NT8DsQ2H$3TrWe9hz4TH9b7Qwj5k0H0SetEnvIfNoCase 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