【问题标题】:DirectoryIndex not working because of mod_rewrite?由于 mod_rewrite,DirectoryIndex 不起作用?
【发布时间】:2010-05-12 16:38:57
【问题描述】:

对 www.domainname.com 和 domainname.com 的请求应该显示 index.html,而不是现在的 index.php。

这是 .htaccess 文件:

# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

我尝试将 DirectoryIndex index.html 添加到文件中,但没有奏效。我怀疑这与 mod_rewrite 的东西有关,但作为一个 apache-n00b 我真的只是在抓稻草。

我可以添加重写,或者我应该怎么做?

【问题讨论】:

    标签: apache mod-rewrite


    【解决方案1】:

    奇怪的是,您的 .htaccess 对我来说工作正常,当我请求目录时,我得到了 index.html。

    您可以尝试插入此规则:

    RewriteCond ^/$ /index.html [L]
    

    如果这不起作用,请获取一些调试信息:

    RewriteLog "/some/writable/path/rewrite.log"
    RewriteLogLevel 3
    

    【讨论】:

    • 不,我的意思是当我将该 .htaccess 复制到我自己的网站时。
    猜你喜欢
    • 1970-01-01
    • 2015-07-12
    • 2013-02-02
    • 2012-12-18
    • 2011-06-29
    • 1970-01-01
    • 2013-01-15
    • 1970-01-01
    • 2018-10-17
    相关资源
    最近更新 更多