简体   繁体   English

使用HTTPS的Wordpress重定向循环

[英]Wordpress Redirect Loop with HTTPS

I have a weird problem that when I set the site address and wordpress address to https (within settings > General) I'm receiving a redirect loop when accessing the wp-admin and no css/js etc on the front end (with the error This request has been blocked; the content must be served over HTTPS .) 我有一个奇怪的问题,当我将站点地址和wordpress地址设置为https(在“设置”>“常规”下)时,在访问wp-admin且前端没有css / js等时,我收到重定向循环(错误) 该请求已被阻止;必须通过HTTPS提供内容 。)

Is there something I'm doing wrong? 我做错了什么吗?

I've tried redirecting to https with htaccess: 我尝试使用htaccess重定向到https:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.yoursite.com/$1 [R,L]
</IfModule>

as well as various plugins but keep getting the redirect loop issue! 以及各种插件,但不断出现重定向循环问题!

Update 更新资料

I've tried: 我试过了:

RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

and still getting a redirect loop! 仍然得到重定向循环!

Cheers. 干杯。

If you have a plugin that has a setting that forces the site to use http that can be your problem. 如果您有一个插件,该插件的设置会迫使网站使用http,这可能是您遇到的问题。 This happened to me once with WooCommerce. WooCommerce在我身上发生过一次。 The checkout used https but the plugin forced the page into http which was then forced into https etc... 结帐使用的是https,但是插件将页面强制为http,然后将其强制为https等。

Found the answer to this here: Wordpress WP-ADMIN HTTPS Redirect Loop 在这里找到了答案: WordPress WP-ADMIN HTTPS重定向循环

Add the following to wp-config.php: 将以下内容添加到wp-config.php中:

$_SERVER['HTTPS'] = 'on';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM