I have read Deny from all in subdirectory htaccess not overriding file rules in root htaccess and htaccess "order" Deny, Allow, Deny but I don't see why this does not work:
Order Deny,Allow
<Files articles/*.*>
Deny from all
</Files>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
The file example.com/articles/test.txt
is still viewable, whereas it should not. This shows that the articles/*.*
rule does not work.
Where is the problem in my .htaccess
?
Note: Since I have Apache 2.4, I have tried:
<Files "articles/*.*">
Require all denied
</Files>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
but the problem is still there.