Skip to content

Instantly share code, notes, and snippets.

@r3code
Last active April 6, 2018 12:32
Show Gist options
  • Select an option

  • Save r3code/39c9e770479ce9b3a4726122bbd618f7 to your computer and use it in GitHub Desktop.

Select an option

Save r3code/39c9e770479ce9b3a4726122bbd618f7 to your computer and use it in GitHub Desktop.
htaccess for password protect based on domain name (for multisite CMS dev)
# Password protect for site.ru while in DEV
SetEnvIf host ^site\.ru$ noauth=1
SetEnvIf host ^www\.site\.ru$ noauth=1
# Put your password auth stuff here
AuthName 'Restricted Area site.ru'
AuthType Basic
AuthUserFile /path/to/.authfile
Require valid-user
#Here is where we allow/deny
Order Deny,Allow
Satisfy any
Deny from all
Require valid-user
Allow from env=noauth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment