Skip to content

Instantly share code, notes, and snippets.

@LouWii
Last active April 10, 2020 06:57
Show Gist options
  • Save LouWii/c48bf908a906f7d4da0c to your computer and use it in GitHub Desktop.
Save LouWii/c48bf908a906f7d4da0c to your computer and use it in GitHub Desktop.

Revisions

  1. LouWii revised this gist Jun 10, 2015. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -15,4 +15,9 @@ Satisfy any
    # 1. a valid authenticated user
    Require valid-user
    # or 2. the "require_auth" var is NOT set
    Allow from env=!require_auth
    Allow from env=!require_auth


    ### Useful links
    #### http://stackoverflow.com/questions/4068975/domain-name-specific-code-blocks-in-htaccess
    #### http://stackoverflow.com/questions/14603568/password-protect-a-specific-url
  2. LouWii created this gist Jun 10, 2015.
    18 changes: 18 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    ### If the server is accessed throught the dev URL example.dev
    ### User will need to authenticate.
    SetEnvIf Host ^example\.dev$ require_auth=true

    AuthUserFile /Path/To/.htpasswd
    AuthName "Password Protected"
    AuthType Basic

    # Setup a deny/allow
    Order Deny,Allow
    # Deny from everyone
    Deny from all
    # except if either of these are satisfied
    Satisfy any
    # 1. a valid authenticated user
    Require valid-user
    # or 2. the "require_auth" var is NOT set
    Allow from env=!require_auth