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

2023-09-02 00:34:01 作者:染恋桑年至久

我已经建立了一个开发站点,并希望设置密码保护,以便只有经过验证的游客可以查看该网站。一切都很好。我越来越生气,在我的本地版本,输入我的用户名和密码。因此,在不改变我的本地副本和一个在开发站点之间的htaccess文件,我如何用密码保护的网站,但让自己进入,而不必输入自己的用户名和密码?

I have set up a dev site and want to password protect it so only validated visitors can view the site. All well and good. I am getting annoyed, on my local version, entering my username and password. So, without changing the htaccess file between my local copy and the one on the dev site, how do I password protect the site but allow myself access without having to enter my username and password?

推荐答案

像这样的东西应该做的伎俩。

Something like this should do the trick..

Require valid-user
Allow from 127.0.0.1
Satisfy Any

从:http://httpd.apache.org/docs/2.0/mod/core.html#satisfy