我试图用密码保护我的公共文件夹,以便任何试图访问外部被提示输入密码,而不是本地。到目前为止,我已完成了使用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
发布评论