htaccess的密码保护功能允许127.0.0.1而不是localhost

编程入门 行业动态 更新时间:2024-10-09 12:32:04
本文介绍了htaccess的密码保护功能允许127.0.0.1而不是localhost的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图用密码保护我的公共文件夹,以便任何试图访问外部被提示输入密码,而不是本地。到目前为止,我已完成了使用127.0.0.1工作,但不是localhost。很显然,我可以只使用的IP地址,但它更多的我想知道为什么它不工作的事实。我不喜欢被打败了!

I'm attempting to password protect my public folder so that anyone trying to access externally is prompted to enter a password but not locally. So far I have got it to work using 127.0.0.1 but not localhost. Obviously I COULD just used the ip address but it's more the fact I want to know why it doesn't work. I don't like to be defeated!

#Enable Password Protection AuthName "Password Protected Server" AuthType Basic AuthUserFile c:\xampp\apache\security\.htpasswd Require valid-user Order allow,deny Allow from localhost Allow from 127.0.0.1 Satisfy Any

我的code迄今的积累:

My code so far is an accumulation of:

www.groovypost/howto/how-to/htaccess-password-protect-apache-website-security/

htaccess密码保护,但不能在本地主机

我在Windows 7上运行的XAMPP 1.7.3,如果有帮助。

I'm running XAMPP 1.7.3 on Windows 7, in case that helps.

任何援助将大大AP preciated!

Any assistance would be greatly appreciated!

推荐答案

听起来像是一个IPv6的问题。当你连接到站点127.0.0.1,阿帕奇认为该请求是在IPv4本地主机(127.0.0.1)的到来。但是,连接到本地主机时,阿帕奇认为该请求从本地主机IPv6的未来(:: 1)。

Sounds like an IPv6 issue. When you're connecting to the site with 127.0.0.1, Apache sees the request as coming from the IPv4 localhost (127.0.0.1). But, when connecting to localhost, Apache sees the request as coming from the IPv6 localhost (::1).

如果这是问题,你应该能够通过更换从本地主机允许行来解决它从:: 1允许行。

If this is the problem, you should be able to solve it by replacing the Allow from localhost line with a Allow from ::1 line.

更多推荐

htaccess的密码保护功能允许127.0.0.1而不是localhost

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

发布评论

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

>www.elefans.com

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