Apache 您可以更改特定目录的DirectoryIndex吗?
我知道您可以在.htaccess中使用Apache 您可以更改特定目录的DirectoryIndex吗?,apache,.htaccess,directoryindex,Apache,.htaccess,Directoryindex,我知道您可以在.htaccess中使用directoryindexample.html,但我需要的是更改特定目录的索引,如下所示: DirectoryIndex /ex/index_file.html 或 你有没有办法做到这一点?我不想将我尝试执行此操作的文件重命名为index.html,因为它不是这样的。你需要先登录,如果你没有登录,它会重定向你;但是我认为这看起来很草率。您可以在每个目录中创建一个.htaccess,您需要在其中创建不同的目录索引。ex目录中的.htaccess应包含: D
directoryindexample.html
,但我需要的是更改特定目录的索引,如下所示:
DirectoryIndex /ex/index_file.html
或
你有没有办法做到这一点?我不想将我尝试执行此操作的文件重命名为index.html,因为它不是这样的。你需要先登录,如果你没有登录,它会重定向你;但是我认为这看起来很草率。您可以在每个目录中创建一个.htaccess,您需要在其中创建不同的目录索引。
ex
目录中的.htaccess应包含:
DirectoryIndex index_file.html
DirectoryIndex index_file2.html
但是ex2
中的on应该包含:
DirectoryIndex index_file.html
DirectoryIndex index_file2.html
您还可以在web根目录中的.htaccess中使用,只要允许您覆盖此项:
<Directory ex>
DirectoryIndex index_file.html
</Directory>
<Directory ex2>
DirectoryIndex index_file2.html
</Directory>
DirectoryIndex_file.html
DirectoryIndex_file2.html
您可以在每个需要不同目录索引的目录中创建.htaccess。ex
目录中的.htaccess应包含:
DirectoryIndex index_file.html
DirectoryIndex index_file2.html
但是ex2
中的on应该包含:
DirectoryIndex index_file.html
DirectoryIndex index_file2.html
您还可以在web根目录中的.htaccess中使用,只要允许您覆盖此项:
<Directory ex>
DirectoryIndex index_file.html
</Directory>
<Directory ex2>
DirectoryIndex index_file2.html
</Directory>
DirectoryIndex_file.html
DirectoryIndex_file2.html
我的意思是,假设我有两个单独的目录dir1
和dir2
。对于dir1
我希望目录索引为example.html
,对于dir2
我希望目录索引为另一个示例.html
。这有用吗?哦,明白了,我想你可以在下面读答案,我想应该是这样的,我的意思是,假设我有两个单独的目录dir1
和dir2
。对于dir1
我希望目录索引为example.html
,对于dir2
我希望目录索引为另一个示例.html
。这有用吗?哦,明白了,我想你可以在下面读答案,我想它应该能解决我的问题。:)我想你也许能做到,我想我应该在发帖之前试一下;哦,好吧。谢谢你的帮助!这解决了我的问题我想你也许能做到,我想我应该在发帖之前试一下;哦,好吧。谢谢你的帮助!