【问题标题】:Htaccess too many redirects only for wordpress blogHtaccess 太多重定向仅适用于 wordpress 博客
【发布时间】:2017-07-21 08:44:22
【问题描述】:

我有以下 htaccess 用于重定向到 www、https 和 index.html 到 /:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteBase /
RewriteRule ^index\.html$ / [NC,R,L]

在网站上,我在 /blog 上使用 wordpress 博客,如果我尝试访问它会出现此错误:

ERR_TOO_MANY_REDIRECTS

我可以通过交换规则顺序来解决这个问题,首先重定向到 www,然后是 https,但是重定向到 www 不起作用

【问题讨论】:

    标签: .htaccess


    【解决方案1】:

    好的,我找到了问题。作为程序员,您确实应该不时检查有权访问网站设置的人在做什么。

    在设置中管理员的 wordpress 登录 -> 常规中输入了一个自定义域,即 https://example.com/blog 等。这意味着 wordpress 博客重定向回没有 www 的版本。

    解决方法是将 www 添加到 wordpress 设置中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-10
      • 1970-01-01
      • 2015-08-28
      • 1970-01-01
      • 2019-09-11
      • 1970-01-01
      相关资源
      最近更新 更多