Answer the question
In order to leave comments, you need to log in
How to allow some paths in htaccess not to use Basic Auth?
I have Apache 2.4 on my server.
A site is set up that is closed to the general public through a password request (Basic Auth).
Challenge: Do not require a password for certain paths.
After reading this article, my .htaccess looks like this:
Authtype Basic
AuthName "Test server"
AuthUserFile /xxxx/.htpasswd
<RequireAny>
Require expr %{REQUEST_URI} =~ m#^/dir1/.*#
Require expr %{REQUEST_URI} =~ m#^/dir2/.*#
Require valid-user
</RequireAny>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</IfModule>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question