阿帕奇 - 如何否认目录但允许一个文件在dirctory [英] Apache - How to deny directory but allow one file in that dirctory

查看:108
本文介绍了阿帕奇 - 如何否认目录但允许一个文件在dirctory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试配置我的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>

我想AP preciate你的帮助。
谢谢!

I would appreciate your help. Thanks!

推荐答案

它完美,如果它被正确配置:

It works perfectly if it is configured properly:

   <Directory /var/www/denied_directory>
        Order allow,deny
        <Files test.php>
           Order deny,allow
        </Files>
   </Directory>

这篇关于阿帕奇 - 如何否认目录但允许一个文件在dirctory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆