Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
仅使用.htaccess禁用所有子目录的php_Php_Apache_.htaccess - Fatal编程技术网

仅使用.htaccess禁用所有子目录的php

仅使用.htaccess禁用所有子目录的php,php,apache,.htaccess,Php,Apache,.htaccess,我需要禁用子文件夹中的php脚本,而不是根index.php中的脚本 例如,我的文件: index.php test.php 1/index.php 2/index.php class/*.php 2/test.php .../... .php 我想禁用根目录和类目录中除index.php之外的所有php文件 我尝试使用索引根: php_flag engine off <Files index.php> php_flag engine on </Files>

我需要禁用子文件夹中的php脚本,而不是根index.php中的脚本

例如,我的文件:

index.php
test.php
1/index.php
2/index.php
class/*.php
2/test.php
.../... .php
我想禁用根目录和类目录中除index.php之外的所有php文件

我尝试使用索引根:

php_flag engine off

<Files index.php>
    php_flag engine on
</Files>
php\u标志引擎关闭
php_标志引擎打开
但这将启用所有带有
index.php
的文件


现在我如何在根目录中禁用所有子文件夹expect类和所有文件expect index.php?

我不明白。如果只是为了禁用文件的PHP处理,为什么需要在目录中包含PHP文件。重命名文件.txt或其他名称,并锁定目录权限,以便任何人都无法访问它。

谢谢您,但需要使用Apache handler忽略它们。
php\u flag引擎关闭php\u flag引擎打开