【发布时间】:2011-09-17 18:38:32
【问题描述】:
我刚刚完成将我完全静态的 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,将其移到顶部不起作用:(
【问题讨论】:
标签: php .htaccess redirect indexing directoryindex