Skip to content

Instantly share code, notes, and snippets.

@stefanzweifel
Created August 3, 2014 14:38
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 stefanzweifel/7ce9076de8125d01874d to your computer and use it in GitHub Desktop.
Save stefanzweifel/7ce9076de8125d01874d to your computer and use it in GitHub Desktop.
Restrict all traffic except your IP address and more with .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
# If the IP address does not match this one
RewriteCond %{REMOTE_ADDR} !^110.110\.110\.110$
# And they are not accessing a certain subdirectory
RewriteCond %{REQUEST_URI} !^/admin
# And they are not accessing the development domain
RewriteCond %{HTTP_HOST} !^development\.example\.com$
# Redirect them to a temporary site
RewriteRule ^(.*)$ http://www.construction.com [R=302,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment