我有一个文件服务器,使用mod_autoindex来提供文件服务。我在htaccess中设置了用户名和密码,以便只有特定的人可以访问这些文件。我已经向htpasswd添加了另一个用户,但我只希望该用户可以访问某些文件/文件夹。
这是我的htaccess文件:
AuthType Basic
AuthName "restricted"
AuthUserFile E:\\path\\to\\.htpasswd
<Files "filesForAnyUser\\*">
Require valid-user
</Files>
<Files "*">
Require user admin
</Files>
我相信我做错了什么,但是我找不到任何好的文档来解决这个问题。
E:\\path\\to\\.htpasswd
考虑改为E:/path/to/.htpasswd
,在某些特定情况下使用相反的斜杠将为您节省一些麻烦。 - Prix