htaccess的密码保护,不同的用户文件

编程入门 行业动态 更新时间:2024-10-09 14:18:53
本文介绍了htaccess的密码保护,不同的用户文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个文件服务器,我用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的密码保护,不同的用户文件

本文发布于:2023-11-01 01:10:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547810.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:密码保护   文件   用户   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!