将WordPress切换为https后重定向过多 [英] Too many Redirects after switching WordPress to https

查看:103
本文介绍了将WordPress切换为https后重定向过多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用我的WordPress博客,我切换到https。因此,我将以下代码添加到我的.htaccess文件中。我现在的问题是,我遇到了重定向过多的问题。谢谢您的提示!

with my WordPress-Blog, I switch to https. Therefore, I have add the following code to my .htaccess-File. My Problem now is, that I get the issue "Too many Redirects". Thank you for your tips!

域是子域:

https://en.example.com

# Begin Force SSL
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
# End Force SSL
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress


推荐答案

尝试更改您的第一个三行:

Try changing your first three lines to:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]

相信,除非您尝试转到 https://en.example.com /:443 ,那么{SERVER_PORT}将永远不会返回443。

I believe, that unless you attempted to go to https://en.example.com/:443 then {SERVER_PORT} will never return 443.

这篇关于将WordPress切换为https后重定向过多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆