由网友(盲僧)分享简介:所以我想限制访问的URL。现在,如果他们是从一个特定的IP地址来了,他们应该不会提示输入密码。如果他们不从得到安宁的IP地址来了,就应该被提示输入密码。因此任一或:的AuthUserFile /some/path/.htpasswdAuthName指令请登录与AuthType基本需要有效的用户和为了否认,允许...
所以我想限制访问的URL。现在,如果他们是从一个特定的IP地址来了,他们应该不会提示输入密码。如果他们不从得到安宁的IP地址来了,就应该被提示输入密码。
因此任一或:
的AuthUserFile /some/path/.htpasswd
AuthName指令请登录
与AuthType基本
需要有效的用户
和
为了否认,允许
所有否认
允许x.x.x.x
解决方案
您可以使用Apache 满足指令。
下面是使用它的一个例子:
与AuthType基本
AuthName指令请登录
的AuthUserFile /some/path/.htpasswd
需要有效的用户
订单拒绝,允许
所有拒绝
从127.0.0.1允许
满足任何
无密码访问只能从127.0.0.1允许的。
希望这有助于。
So I want to restrict access to a url. Now if they are coming from a given IP address then they shouldn't be prompted for a password. If they are not coming from a givin IP address then they should be prompted for a password.
so a either or of:
AuthUserFile /some/path/.htpasswd
AuthName "Please Log In"
AuthType Basic
require valid-user
and:
order deny,allow
deny from all
allow from x.x.x.x
解决方案
You can use the Apache "Satisfy" directive.
Here is an example of using it :
AuthType Basic
AuthName "Please Log In"
AuthUserFile /some/path/.htpasswd
Require valid-user
Order deny,allow
Deny from all
Allow from 127.0.0.1
Satisfy any
Access without password is only allowed from 127.0.0.1.
Hope this helps.
相关推荐
最新文章