AuthUserFile /.htpasswds/.htpasswd 谁能告诉我,这个路径是怎么写的啊?

silkstockings 2010-06-07 02:59:36
.htaccess文件里面限制访问
<IfModule mod_auth.c>
AuthName "Username and password required"
AuthUserFile /.htpasswds/.htpasswd
AuthType Basic
Require valid-user
Order Allow,Deny
Allow from all
# Country: CHINA
# ISO Code: CN
# Total Networks: 1,764
# Total Subnets: 250,452,480
deny from 1.12.0.0/14

服务器上:我FTP登录之后有:www文件夹,public_html文件夹(www),.htpasswds文件夹。

我的.htaccess文件是放在www文件夹里了,.htpasswd这个我放到.htpasswds文件夹里面了,但是路径不对,似乎访问不到!

谁知道怎么写啊?
...全文
450 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
steptodream 2010-06-07
  • 打赏
  • 举报
回复
仔细阅读一下关于.htaccess的官方文档
http://man.chinaunix.net/newsoft/Apache2.2_chinese_manual/howto/htaccess.html
steptodream 2010-06-07
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 silkstockings 的回复:]
LINUX 空间,我ftp登陆上去就看到.htpasswds文件夹,就放那里去了。
.htpasswds文件夹与www文件夹是同级别的

上面的是我htaccess文件的内容!

不知道为什么不生效啊!?
[/Quote]
你最好跟你的服务器的管理方联系一下
支持.htaccess需要在httpd.conf里配置的 针对所有站点或者是针对的你的站点目录要配置的
AllowOverride All

另外我跟你说密码文件需要的是相对服务器的跟目录/来说的绝对路径/full/path/.htpasswds/.htpasswd
不是以你登陆后的路径为根目录来讲
比如/home/webuser/silkstockings/.htpasswds/.htpasswd
silkstockings 2010-06-07
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 yifanwu 的回复:]
# Country: CHINA
# ISO Code: CN
# Total Networks: 1,764
# Total Subnets: 250,452,480
[/Quote]

什么?
silkstockings 2010-06-07
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 steptodream 的回复:]
我感觉是.htaccess文件的设置没有生效(需要修改http.conf) 如果.htaccess生效了的话 无论密码文件的路径是否正确
都应该出来认证画面 只是密码文件的路径错误的话 认证不会成功
[/Quote]
# password protect only for specified ips
<IfModule mod_auth.c>
AuthName "Username and password required"
AuthUserFile /.htpasswds/.htpasswd
AuthType Basic
Require valid-user
Order Allow,Deny
Allow from all
# Country: CHINA
# ISO Code: CN
# Total Networks: 1,764
# Total Subnets: 250,452,480
deny from 1.12.0.0/14
.....
.....
deny from 1.24.0.0/13
#
Satisfy Any
</IfModule>

LINUX 空间,我ftp登陆上去就看到.htpasswds文件夹,就放那里去了。
.htpasswds文件夹与www文件夹是同级别的

上面的是我htaccess文件的内容!

不知道为什么不生效啊!?
yifanwu 2010-06-07
  • 打赏
  • 举报
回复
# Country: CHINA
# ISO Code: CN
# Total Networks: 1,764
# Total Subnets: 250,452,480
steptodream 2010-06-07
  • 打赏
  • 举报
回复
我感觉是.htaccess文件的设置没有生效(需要修改http.conf) 如果.htaccess生效了的话 无论密码文件的路径是否正确
都应该出来认证画面 只是密码文件的路径错误的话 认证不会成功

AuthUserFile /.htpasswds/.htpasswd
这里的秘密文件要用服务器的绝对路径/full/path/.htpasswds /.htpasswd
如果你不知道 询问服务器管理员

个人观点 仅供参考
灵雨飘零 2010-06-07
  • 打赏
  • 举报
回复
帮顶!
silkstockings 2010-06-07
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 wuyq11 的回复:]
配置.htaccess\.htpasswd文件
[/Quote]

不行,我看了,还是不能生效
wuyq11 2010-06-07
  • 打赏
  • 举报
回复
silkstockings 2010-06-07
  • 打赏
  • 举报
回复
楼上的 我不知道你那个是啥意思啊!@
宝_爸 2010-06-07
  • 打赏
  • 举报
回复
Further note that Apache must look for .htaccess files in all higher-level directories, in order to have a full complement of directives that it must apply. (See section on how directives are applied.) Thus, if a file is requested out of a directory /www/htdocs/example, Apache must look for the following files:

/.htaccess
/www/.htaccess
/www/htdocs/.htaccess
/www/htdocs/example/.htaccess
her886 2010-06-07
  • 打赏
  • 举报
回复
JF 帮顶
silkstockings 2010-06-07
  • 打赏
  • 举报
回复
谁知道? 在线等

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧