我在Apache中有一个目录。它受基本身份验证保护。授权如下:
require valid-user
现在我想根据IP改变组,例如:
<if ip from subnet a>
require user1
<else>
require user2
<end if>
这在Apache中是否可行?
答案 0 :(得分:2)
这可能有点晚了但作为参考,对我有用的解决方案是:
Deny from all
Order deny,allow
AuthName "blah blah blah"
AuthUserFile path/to/.htpasswd
AuthType Basic
Require valid-user
Allow from 192.168.
Satisfy Any
这将允许您强制除了指定域之外的htpass,否则此链接有很多好的信息重新分组http://petergasser.com/codebase/comments.php?DiscussionID=38但是从该页面获取,这是否完成了您需要它做的事情?< / p>
“管理员可以从任何地方查看此页面,其他人必须来自golden.net IP地址:”
htaccess的:
AuthUserFile /usr/home/lee/htpasswd
AuthGroupFile /usr/home/lee/htgroup
AuthName "Lee's Secret Area"
AuthType Basic
Satisfy Any Default is Satisfy ALL
<Limit GET POST>
order deny,allow
deny from all
allow from .golden.net
require group managers
</Limit>
目录AuthGroupFile:
managers: cisco bob tim jeff kari
systems: lee joe cisco
sales: kari tonja