htpasswd in subdirectory not working

293 Views Asked by At

I wanted to secure a subdirectory of my website with the htpasswd user authentication.

But somehow the .htaccess in the root is overriding the .htaccess in the directory? How is this even possible?

.htaccess in subdirectory

AuthName "Foobar"
AuthType Basic
AuthUserFile /var/www/foo.com/web/secretdirectory
require valid-user

The .htaccess in the root contains a lot of mod_rewrite but that does not influence the inheritance of the .htaccess files? Right?

.htaccess root

Satisfy Any
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]

RewriteCond %{REQUEST_URI} oxseo\.php$
RewriteCond %{QUERY_STRING} mod_rewrite_module_is=off
RewriteRule oxseo\.php$ oxseo.php?mod_rewrite_module_is=on [L]

RewriteCond %{REQUEST_URI} !(\/admin\/|\/core\/|\/export\/|\/modules\/|\/out\/|\/setup\/|\/tmp\/|\/views\/)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !(\.html|\/|\.jpg|\.css|\.pdf|\.doc|\.gif|\.png|\.js|\.htc)$ %{REQUEST_URI}/ [R=301,L]

RewriteCond %{REQUEST_URI} !(\/admin\/|\/core\/|\/export\/|\/modules\/|\/out\/|\/setup\/|\/tmp\/|\/views\/)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (\.html|\/)$ oxseo.php

RewriteCond %{REQUEST_URI} (\/out\/pictures\/)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (\.jpe?g|\.gif|\.png)$ core/utils/getimg.php
</IfModule>
Options -Indexes
DirectoryIndex index.php index.html

Thank you for any clues!

0

There are 0 best solutions below