Skip to content

Instantly share code, notes, and snippets.

@prashantpalikhe
Forked from snipe/htaccess-ip-lock
Last active August 29, 2015 14:15
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 prashantpalikhe/0b6703abb81ba9980b8a to your computer and use it in GitHub Desktop.
Save prashantpalikhe/0b6703abb81ba9980b8a to your computer and use it in GitHub Desktop.
# Welcome to your htaccess file.
# Remember that modifying this file can break the entire website
# so please edit carefully.
# Also remember that the order of the rules below does matter,
# so be sure of what you're doing before shuffling things around.
AuthType Basic
AuthName "My Dev Environment"
# Specify what user/password file the server should look
# for a valid login for if the IP doesn't match
# any of the allowed IPs below
AuthUserFile /var/www/staging/public/.htpasswd
require valid-user
# Deny by default
order deny,allow
deny from all
# Then set your office/client/etc IP addresses to allow without
# a username/password. Everyone other than these IPs will be
# prompted to enter credentials
allow from 127.0.0.1
allow from 123.45.67.89
# etc..
Satisfy ANY
# Now you can do any mod_rewrite shenanigans here
RewriteEngine On
# Rewrite rules....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment