在 XAMPP/Apache 的文件夹中找不到 .htaccess 错误 404

Error 404 not found with .htaccess in folder on XAMPP/Apache

我在 Windows Server 2003 上有一个带有 XAMPP (Apache/PHP/MySQL) 运行 的测试服务器。

我一直都没有问题地使用 .htaccess 和 .htpasswd 文件。在我工作的网站上,当我尝试打开受 .htaccess 保护的目录中的任何文件时,我得到 错误 404(是的!不是 403),它看起来像:

<Files .htaccess>
order allow,deny
deny from all
</Files>

AuthName "Area riservata"
AuthUserFile \WEB\TEST\keys\.htpasswd
AuthType Basic
require valid-user

我将 .htpasswd 目录更改为与 .htaccess (\WEB\TEST\public_html\admin\.htaccess) 文件相同的目录,但没有成功!

如果我删除文件,一切正常:apache 日志和错误日志什么也没说。

problem/error在哪里?

编辑

在我的 DOCUMENT_ROOT (\WEB\TEST\public_html\) 上,我有这个 .htaccess 文件。 我发现在评论最后一行时(如下 - 对于非文件和符号链接不重定向到 index.php)我的问题消失了。我不明白为什么!

 RewriteEngine On
 RewriteCond %{REQUEST_URI} ^/(it|de|fr|en)/(.*)$ [NC]
 RewriteCond %{DOCUMENT_ROOT}/multi_html/%2 -s
 RewriteRule ^(it|de|fr|en)/(.*)$ /multi_html/?lingua= [NC,L,QSA]

 RewriteCond %{REQUEST_FILENAME} !-l
 RewriteCond %{REQUEST_FILENAME} !-s
#RewriteRule . index.php [NC,L]

我找到了答案:

AuthName "Authorisation Required"
AuthUserFile "\WEB\TEST\keys\.htpasswd"
AuthType Basic
require valid-user
ErrorDocument 401 "Authorisation Required"   <-- ADD THIS LINE

Apache 对此做了一些更改,指定 401 错误文档是必要的,因为 Apache 在使用 .htpasswd.

时正在寻找它