.htaccess.拒绝 root,允许特定的子文件夹.可能的? [英] .htaccess. deny root, allow specific subfolder. Possible?
本文介绍了.htaccess.拒绝 root,允许特定的子文件夹.可能的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何拒绝访问 http://sub.mydomain.com/,但允许 (完全)http://sub.mydomain.com/test(或 http://sub.mydomain.com/test/)
How can I deny access to http://sub.mydomain.com/, but allow for (completely) http://sub.mydomain.com/test (or http://sub.mydomain.com/test/)
推荐答案
.htaccess 指令 应用于该目录及其所有子目录,因此您应该禁止在您的 DocumentRoot 中访问,
.htaccess directives apply to that directory, and all subdirectories thereof, so you should disallow access in your DocumentRoot,
http://sub.mydomain.com/.htaccess:
Order deny,allow
Deny from all
并在您希望允许访问的任何特定子目录中覆盖它,
And override that in any specific subdirectories you would like to allow access to,
http://sub.mydomain.com/test/.htaccess::>
Order allow,deny
Allow from all
这篇关于.htaccess.拒绝 root,允许特定的子文件夹.可能的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文