DirectoryIndex未分配新的默认目录

时间:2011-09-17 18:38:32

标签: php .htaccess redirect indexing directoryindex

我刚刚将完全静态的HTML website更改为PHP版,以便轻松编辑。我在.htaccess文件中使用了301 RedirectMatch,因此将所有.html页面指向新的.php页面。但是,当我这样做时,它决定将我的默认目录从index.php(已经是php一段时间)更改为default.php。我甚至没有名为default.php的文件。无论如何,我试图在我的.htaccess中添加一个DirectoryIndex行,将其更改回index.php,但它仍然对default.php做了。

这是我的.htaccess:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RedirectMatch 301 (.*)\.html$ http://www.fifaencyclopedia.com$1.php
DirectoryIndex index.php

我做错了什么?我该如何解决这个问题?

编辑:我刚刚创建了一个default.php页面,所以那里有一些东西,但我宁愿它是index.php。

编辑:GerManson,把它移到顶端不起作用:(

1 个答案:

答案 0 :(得分:0)

重定向是否有效?

您可能需要在虚拟主机配置上设置AllowOverride All

如果它是共享主机,则可能是重定向在DirectoryIndex指令之前工作的情况。把它移到顶部