Search code examples
authentication.htaccessdirectorylocationapache2

deaktivate/disable apache2 .htaccess authentication per directory/location env/setenv/setenvif


To find out how to controll the Apache2 .htaccess authentication forced me hours to search a solution which a ton of solutions that didn't work or was complicated as hell.

All you need:

SetEnvIf Request_URI "^/mydir/?" allow
AuthUserFile /your/.htpasswd
AuthGroupFile /dev/null
AuthName "Restricted"
AuthType Basic
Require valid-user
Require env allow

Solution

  • To find out how to controll the Apache2 .htaccess authentication forced me hours to search a solution which a ton of solutions that didn't work or was complicated as hell.

    See Comment of MrWhite, your can try:

    SetEnvIf Request_URI "^/mydir/?" allow
    AuthUserFile /your/.htpasswd
    AuthGroupFile /dev/null
    AuthName "Restricted"
    AuthType Basic
    Require valid-user
    Require env allow