[英]Usage of Location directive in apache2.2
我正在尝试以下。 尝试了很多方法,但似乎没有任何效果,如果有人有任何想法请帮助。
<Location /MyRoot>
# '/MyRoot' Should only be allowed, and NONE of its sub should be allowed
# Requests will be redirected to weblogic
</Location>
<Location /MyRoot/MySub1>
# '/MyRoot/MySub1' Should be allowed, and all its sub domains should be allowed
# Requests will be redirected to weblogic
</Location>
<Location /MyRoot/MySub2>
# '/MyRoot/MySub1' Should be allowed, and all its sub domains should be allowed
# Requests will be redirected to weblogic
</Location>
我期望的是下面
http://host:port/MyRoot/ --- Should be accessible
http://host:port/MyRoot/MySub1 --- Should be accessible
http://host:port/MyRoot/MySub2 --- Should be accessible
http://host:port/MyRoot/MySub1/MySubSub1 --- Should be accessible
http://host:port/MyRoot/MySub1/MySubSub2 --- Should be accessible
http://host:port/MyRoot/MySub2/MySubSub1 --- Should be accessible
http://host:port/MyRoot/MySub2/MySubSub2 --- Should be accessible
http://host:port/MyRoot/MySub1/MySubSub1 --- Should be accessible
http://host:port/MyRoot/MySub1/MySubSub2 --- Should be accessible
http://host:port/MyRoot/ABC --- Should NOT be accessible
http://host:port/MyRoot/XYZ/LKJ --- Should NOT be accessible
并且MyRoot下可能有许多文件夹,除了(MySub1&MuS),我希望它们不可访问
任何人都可以请教如何实现这一目标的建议。
至少根据我目前的了解,仅根目录中的.htaccess
是不可能的。
您必须使用以下代码在/MyRoot/
上创建.htaccess
:
Order deny,allow
Deny from all
Allow from 127.0.0.1
避免从外部用户列出根目录。 然后,在/MyRoot/MySub1/MySubSub1
, /MyRoot/MySub1/MySubSub2
, /MyRoot/MySub2/MySubSub1
, /MyRoot/MySub2/MySubSub2
,您必须/MyRoot/MySub2/MySubSub2
使用以下命令创建一个.htaccess
:
Allow from all
这应该以某种方式解决您的问题。 希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.