我有一个文件服务器,我用mod_autoindex到服务器中的文件。我在htaccess的用户名和密码,以便只有特定的人可以访问这些文件。我已经加入其他用户HTPASSWD但我只喜欢那个用户访问某些文件/文件夹。
I have a files server and I use mod_autoindex to server the files. I have a username and password in htaccess so only certain people can access the files. I have added another user to htpasswd but I would only like that user to access some of the files/folders.
下面是我的htaccess的文件现在:
Here is my htaccess file now:
AuthType Basic AuthName "restricted" AuthUserFile E:\\path\\to\\.htpasswd <Files "filesForAnyUser\\*"> Require valid-user </Files> <Files "*"> Require user admin </Files>
我敢肯定,我做错了什么,但我无法找到任何这很好的文档。
I'm sure I am doing something wrong but I can't find any good documentation on this.
推荐答案如果您有一个名为filesForAnyUser文件夹,在那里你只对管理有文件的文件夹,你需要做2 htaccess的文件。其中在filesForAnyUser:
If you have a folder called "filesForAnyUser" and a folder where you have files only for admin, you need to make 2 htaccess files. One in "filesForAnyUser":
AuthType Basic AuthName "restricted" AuthUserFile E:\\path\\to\\.htpasswd Require valid-user和一个在其他目录下:
AuthType Basic AuthName "restricted" AuthUserFile E:\\path\\to\\.htpasswd Require user admin更多推荐
htaccess的密码保护,不同的用户文件
发布评论