Disable HTTP authentication for a specific rewritten location

I need to configure apache to match / admin reverse location which is rewritten by drupal htacess by default. Just ask http auth for anything that is not / admin / *

I have tried this so far:

  <LocationMatch "^ / (?! admin)"> 
AuthName "Members Only" AuthType Basic AuthBasicProvider file AuthUserFile /path/to/.htpasswd Require valid-user
</ LocationMatch>
+5
authentication apache mod-rewrite
Dec 01 2018-11-11T00:
source share
1 answer

You can try using SetEnvIf to check Request_URI for / admin, so you should get something like this:

# Set an environment variable if requesting /admin SetEnvIf Request_URI ^/admin/? DONT_NEED_AUTH=true # Setup your auth mechanism AuthName "Members Only" AuthType Basic AuthBasicProvider file AuthUserFile /path/to/.htpasswd # Set the allow/deny order Order Deny,Allow # Indicate that any of the following will satisfy the Deny/Allow Satisfy any # First off, deny from all Deny from all # Allow outright if this environment variable is set Allow from env=DONT_NEED_AUTH # or require a valid user Require valid-user 

You may need to wrap this in appropriate tags or if you do not put this in a .htaccess file.

0
Dec 01 '11 at 10:16
source



All Articles