Skip to content

Instantly share code, notes, and snippets.

@jb510

jb510/htaccess Secret

Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jb510/9a8c978abc0dab7e5344 to your computer and use it in GitHub Desktop.
Save jb510/9a8c978abc0dab7e5344 to your computer and use it in GitHub Desktop.
HTTP Password protection for WPE
Order deny,allow
# Detect the domain host and set a variable telling us to use auth
SetEnvIf Host wpengine.com$ S9_USE_AUTH
#SetEnvIf Host staging.wpengine.com$ S9_USE_AUTH
# Detect the variable telling us to use auth and deny
Deny from env=S9_USE_AUTH
Satisfy any
# Basic authentication
AuthType Basic
AuthName "Nothing to see here. Move along, please"
Require valid-user
# N.B. This path will be specific to your server setup, if this file doesn't exist server will 500.
#AuthUserFile /nas/wp/www/sites/__instancename__/.htpasswd
#AuthUserFile /nas/wp/www/staging/__instancename__/.htpasswd
# Don't allow the .htpasswd file to be shown to web users
<Files .htpasswd>
Order allow,deny
Deny from all
Satisfy All
</Files>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment