I must have discovered a bug in Apache! Because I have the wierdest issue with my webhost. I cannot access a folder named admin. It works in one virtualhost but not the other. (Same hosting account)
/.htaccess
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
# No logic for resolved paths
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^ - [L]
RewriteRule .* index.php [L]
</IfModule>
/admin/.htaccess:
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /home/user/domains/mydomain.com/public_html/admin/.htpasswd
Require valid-user
Resolving http://www.mydomain.com/admin/index.php I get 404 not found. If I remove the admin/.htaccess file the page resolves. What's up with that?
The problem derives from the ErrorDocument setting. Adding the following line to admin/.htaccess solves the problem
ErrorDocument 401 "Access Denied"