Apache-如何拒绝目录但允许该目录中的一个文件 [英] Apache - How to deny directory but allow one file in that directory
本文介绍了Apache-如何拒绝目录但允许该目录中的一个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试将Apache .conf文件配置为拒绝某个类别的列表,但是我想允许该类别中的特定文件. 看来目录"规则比文件"规则强",所以当同时使用目录"规则时-我无法访问该特定文件.
I try to configure my Apache .conf file to deny listing from a certain category, but I want to allow a specific file inside this category. It appears that the Directory rule is "stronger" than the Files rule, so when using both - I can't access that certain file.
这是我尝试的方法:
<Directory /var/www/denied_directory>
order deny,allow
Deny From All
</Directory>
<Files safefile.php>
Order Allow,Deny
Allow from All
</Files>
推荐答案
如果配置正确,它会完美运行:
It works perfectly if it is configured properly:
<Directory /var/www/denied_directory>
Order allow,deny
<Files test.php>
Order deny,allow
</Files>
</Directory>
这篇关于Apache-如何拒绝目录但允许该目录中的一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文