【发布时间】:2017-04-12 18:05:43
【问题描述】:
我有一个我正在尝试使用 SSL 设置的 WordPress 网站。该站点正在运行,但管理仪表板除外,这会导致 Chrome 中出现此错误:
ERR_TOO_MANY_REDIRECTS
我在 StackOverflow 上发现了一篇有助于 HTTPS 重定向的帖子,因为 Heroku 显然做的事情有点不同。尽管如此,我仍然坚持这个错误。
我已将此添加到我的 wp-config.php 文件中,但没有成功:
define('FORCE_SSL_ADMIN', true);
我的 .htaccess 文件如下所示:
# BEGIN s2Member GZIP exclusions
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} (^|\?|&)s2member_file_download\=.+ [OR]
RewriteCond %{QUERY_STRING} (^|\?|&)no-gzip\=1
RewriteRule .* - [E=no-gzip:1]
</IfModule>
# END s2Member GZIP exclusions
#https://stackoverflow.com/questions/26489519/how-to-redirect-to-https-with-htaccess-on-heroku-cedar-stack/26494983#26494983
<IfModule mod_rewrite.c>
##Force SSL
#Normal way (in case you need to deploy to NON-heroku)
RewriteCond %{HTTPS} !=on
#Heroku way
RewriteCond %{HTTP:X-Forwarded-Proto} !https
#If neither above conditions are met, redirect to https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
当我运行 curl --verbose --head --location 时,
我看到它正在从http://easyofficepools.herokuapp.com 和https://easyofficepools.herokuapp.com 来回重定向。我不确定 http 重定向来自哪里。
任何想法都将不胜感激!
编辑:我还注意到 curl 的 PINGBACK 信息是 http,而不是 https:
< X-Pingback: http://easyofficepools.herokuapp.com/xmlrpc.php
X-Pingback: http://easyofficepools.herokuapp.com/xmlrpc.php
【问题讨论】:
标签: wordpress apache mod-rewrite