2012-07-29 45 views
0

我知道,你可以在.htaccess使用DirectoryIndex example.html,但我需要的是改变指数为特定的目录,比如:你可以改变特定目录的DirectoryIndex吗?

DirectoryIndex /ex/index_file.html 

DirectoryIndex /ex2/index_file2.html 

有没有一种方式,你可以做到这一点?我不想重命名文件,我试图做这个index.html,因为这不是它是什么。你需要先登录,如果你不是,它会重定向你;但我认为这看起来很sl。。

+0

没有得到你的问题。 – 2012-07-29 06:54:35

+0

我的意思是说,我有2个单独的目录。 'dir1'和'dir2'。对于'dir1',我希望DirectoryIndex是'example.html',对于'dir2'我希望DirectoryIndex是'another_example.html'。这有帮助吗? – 2012-07-29 07:08:03

+0

哦,明白了我想你可以在那里看到答案,我想它应该解决 – 2012-07-29 07:10:02

回答

1

您可以在每个目录要在.htaccess不同的目录索引在ex目录应包含一个.htaccess:

DirectoryIndex index_file.html 

ex2上应包含以下内容:

DirectoryIndex index_file2.html 

你也可以在你的Web根的.htaccess使用<Directory>只要你被允许覆盖此:

<Directory ex> 
    DirectoryIndex index_file.html 
</Directory> 

<Directory ex2> 
    DirectoryIndex index_file2.html 
</Directory> 
+0

这解决了我的问题。 :)我认为你可以做到这一点,我想我应该在发布问题之前尝试过;好吧。谢谢您的帮助! – 2012-07-29 07:08:22

相关问题