我想阻止访问“sub / folder / index.php”,而不是其他地方的“index.php”.
<Files index.php> Order allow,deny Deny from all </Files>
但是阻止所有的“index.php”文件.
<Files sub/folder/index.php> Order allow,deny Deny from all </Files>
不行我需要使用< Directory>?
我不想在sub /文件夹中创建一个.htaccess文件
我没有访问httpd.conf
我不想阻止子目录中的所有内容
如果这样很容易,我不会问;)
我认为最简单的规则是:
RedirectMatch 403 ^.*/sub/folder/index\.php$
RedirectMatch是在mod_alias模块,你当然有.这并不意味着mod_rewrite引擎.这里我们只是告诉apache,任何访问sub / folder / index.php将会生成一个“403禁止”的答案.
你可以把它放在httpd.conf或根目录.htaccess(但是真的考虑删除所有的.htaccess,它是坏的,它很慢,很遗憾你没有访问真正的配置文件).