【问题标题】:DirectoryIndex not assigning new default directoryDirectoryIndex 未分配新的默认目录
【发布时间】: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


    【解决方案1】:

    重定向是否正常工作?

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

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

    【讨论】:

      猜你喜欢
      • 2013-11-05
      • 2016-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-23
      • 2016-11-10
      • 2019-08-03
      • 1970-01-01
      相关资源
      最近更新 更多