由于 mod_rewrite,DirectoryIndex 无法工作?

发布于 2024-09-01 11:29:13 字数 563 浏览 3 评论 0原文

对 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,我真的只是在抓住救命稻草。

我可以添加重写规则吗?或者我应该做什么?

Requests to www.domainname.com and domainname.com should display index.html, not index.php as it does now.

This is the .htaccess file:

# -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

I tried adding a DirectoryIndex index.html to the file, but that did not work. I suspect that has something to do with the mod_rewrite stuff, but being an apache-n00b I am really just grasping for straws.

Can I add a rewriterule, or what should I do?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

单挑你×的.吻 2024-09-08 11:29:13

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

您可以尝试插入此规则:

RewriteCond ^/$ /index.html [L]

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

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

Strangely, your .htaccess works fine for me and I get index.html when I request the directory.

You might try inserting this rule:

RewriteCond ^/$ /index.html [L]

If that doesn't work, get some debug information:

RewriteLog "/some/writable/path/rewrite.log"
RewriteLogLevel 3
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文