Skip to content

Instantly share code, notes, and snippets.

@designermonkey
Created May 28, 2013 13:42
Show Gist options
  • Select an option

  • Save designermonkey/5662845 to your computer and use it in GitHub Desktop.

Select an option

Save designermonkey/5662845 to your computer and use it in GitHub Desktop.
Set http auth per domain: Apache 2.2
# Check for the hostname here
SetEnvIfNoCase HOST ^(www\.)?website\.co\.uk$ PROTECTED_HOST
<Directory /path/to/htdocs>
AuthType Basic
AuthName "Authentication"
AuthUserFile /path/to/.htpasswd
Order Deny,Allow
Satisfy any
Deny from all
Require valid-user
Allow from env=!PROTECTED_HOST
</Directory>
@designermonkey
Copy link
Author

Allows all domains other than the one specified in the PROTECTED_HOST variable.

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