【问题标题】:Can I declare the DirectoryIndex In .htaccess Non-recursively?我可以非递归地在 .htaccess 中声明 DirectoryIndex 吗?
【发布时间】:2011-06-07 12:30:34
【问题描述】:

在我的 /httpdocs/ 文件夹中,我需要更改 index.php 的文件名。我通过在我的 .htaccess 文件中写一个新行来做到这一点:

DirectoryIndex index2.php

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

【问题讨论】:

    标签: .htaccess recursion directoryindex


    【解决方案1】:

    你可以试试这个……

    DirectoryIndex index2.php index.php index.html
    

    Apache 将从左到右查找索引文件。

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

    【讨论】:

      猜你喜欢
      • 2016-07-15
      • 1970-01-01
      • 2021-05-01
      • 2019-11-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-04
      • 2011-05-22
      相关资源
      最近更新 更多