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
  • Select an option

  • Save prashantpalikhe/0b6703abb81ba9980b8a to your computer and use it in GitHub Desktop.

Select an option

Save prashantpalikhe/0b6703abb81ba9980b8a to your computer and use it in GitHub Desktop.

Revisions

  1. @snipe snipe created this gist Nov 6, 2012.
    35 changes: 35 additions & 0 deletions htaccess-ip-lock
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    # 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....