【问题标题】:redirecting index.html to the root using httpd.conf使用 httpd.conf 将 index.html 重定向到根目录
【发布时间】:2017-02-20 22:04:19
【问题描述】:

我尝试通过使用以下设置配置 Apache 网络服务器 httpd.conf 将所有 index.html 重定向到根文件夹。它能够成功重定向,但是它一直指向 testsite.com// 而不是 testsite.com/。知道为什么它一直用 2 个斜杠“/”转发到 url 吗?感谢您的建议,谢谢!

RewriteEngine On
RewriteRule ^index\.html$ / [R=301,L]
RewriteRule ^(.*)/index\.html$ $1 [R=301,L]

【问题讨论】:

  • 有人可以帮忙吗?谢谢。
  • 没人知道为什么?

标签: redirect root httpd.conf


【解决方案1】:

移除那个怪物并使用:

DirectoryIndex index.html

也适用于缺少的资源:

FallBackResource /index.html

【讨论】:

    猜你喜欢
    • 2017-09-10
    • 2018-06-04
    • 2016-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-16
    • 1970-01-01
    相关资源
    最近更新 更多