我知道您可以DirectoryIndex example.html
在 .htaccess 中使用,但我需要更改特定目录的索引,如下所示:
DirectoryIndex /ex/index_file.html
或者
DirectoryIndex /ex2/index_file2.html
有没有办法可以做到这一点?我不想将我正在尝试执行此操作的文件重命名为 index.html,因为它不是这样的。您需要先登录,如果不是,它将重定向您;但我认为这看起来很草率。
我知道您可以DirectoryIndex example.html
在 .htaccess 中使用,但我需要更改特定目录的索引,如下所示:
DirectoryIndex /ex/index_file.html
或者
DirectoryIndex /ex2/index_file2.html
有没有办法可以做到这一点?我不想将我正在尝试执行此操作的文件重命名为 index.html,因为它不是这样的。您需要先登录,如果不是,它将重定向您;但我认为这看起来很草率。
您可以在每个需要不同目录索引的目录中创建一个 .htaccess。目录中的 .htaccessex
应包含:
DirectoryIndex index_file.html
但是 on inex2
应该包含:
DirectoryIndex index_file2.html
<Directory>
只要您被允许覆盖它,您也可以在您的 Web 根目录中的 .htaccess 中使用:
<Directory ex>
DirectoryIndex index_file.html
</Directory>
<Directory ex2>
DirectoryIndex index_file2.html
</Directory>