I tried to activate auth basic for a virtualhost "Location" directive for virtual url, but it is not working. The same settings on a "Location" directive which points to a directory works fine. I am using lsws 5.2.8 on CentOS 7. No errors found in the apache error log. Browser cache deleted and re-startet, no luck.Any hints what I could try?
I assume it has something to do with the combination of Location and that URL which it should protect get forwarded to a rewrite which is based in the .htaccess file.
this is the original .htaccess file provided by shopware which is located at the "/shop/" (/var/www/vhosts/domain.com/httpdocs/shop) directory of this vhost.
- domain.com/shop/test --> authentication dialogue pops up
- domain.com/shop/backend --> authentication dialogue does not appear
I assume it has something to do with the combination of Location and that URL which it should protect get forwarded to a rewrite which is based in the .htaccess file.
Code:
# WORKING "/shop/test" is a directory
<Location "/shop/test">
AuthType Basic
AuthName "test1"
AuthBasicProvider file
AuthUserFile "/var/www/vhosts/system/domain.com/pd/.htpasswd"
Require valid-user
</Location>
Code:
# NOT WORKING "shop/backend" is a virtual url which get rewritten to shopware.php (see .htaccess file)
<Location "/shop/backend">
AuthType Basic
AuthName "test2"
AuthBasicProvider file
AuthUserFile "/var/www/vhosts/system/domain.com/pd/.htpasswd"
Require valid-user
</Location>
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule shopware.dll shopware.php
RewriteRule files/documents/.* engine [NC,L]
RewriteRule backend/media/(.*) media/$1 [NC,L]
RewriteCond %{REQUEST_URI} !(\/(engine|files|templates|themes|web)\/)
RewriteCond %{REQUEST_URI} !(\/media\/(archive|banner|image|music|pdf|unknown|video)\/)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ shopware.php [PT,L,QSA]
# Fix missing authorization-header on fast_cgi installations
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
</IfModule>
Last edited by a moderator: