我可以非递归地在.htaccess中声明DirectoryIndex吗?

我可以非递归地在.htaccess中声明DirectoryIndex吗?,.htaccess,recursion,directoryindex,.htaccess,Recursion,Directoryindex,在我的/httpdocs/文件夹中,我需要更改index.php的文件名。为此,我在.htaccess文件中写入了新行: DirectoryIndex index2.php 然而,/httpdocs/下的所有子文件夹似乎都在为其目录索引文件寻找index2.php。有没有一种方法可以更改/httpdocs/文件夹的DirectoryIndex文件,而不会递归地影响其下的每个文件夹?您可以试试这个 DirectoryIndex index2.php index.php index.html A

在我的/httpdocs/文件夹中,我需要更改index.php的文件名。为此,我在.htaccess文件中写入了新行:

DirectoryIndex index2.php
然而,/httpdocs/下的所有子文件夹似乎都在为其目录索引文件寻找index2.php。有没有一种方法可以更改/httpdocs/文件夹的DirectoryIndex文件,而不会递归地影响其下的每个文件夹?

您可以试试这个

DirectoryIndex index2.php index.php index.html
Apache将从左到右查找索引文件

例如,如果
index2.php
不存在,它将查找
index.php

,您可以试试这个

DirectoryIndex index2.php index.php index.html
Apache将从左到右查找索引文件

例如,如果
index2.php
不存在,它将查找
index.php