Cpanel / WHM服务器无法将wordpress站点从http重定向到https

时间:2016-01-01 12:29:35

标签: wordpress .htaccess https cpanel

我通过Comodo收到了我的证书并通过cPanel安装了它。当我转到网址时,它显示在我的浏览器上,但是当我得到302重定向循环时,我无法获取网页的内容。我将我的htaccess文件更改为

# BEGIN WordPress
<IfModule mod_rewrite.c>

  RewriteEngine On
  RewriteCond %{SERVER_PORT} 80
  RewriteRule ^(.*)$ https://www.example.org/$1 [R,L]

  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]

</IfModule>
# END WordPress

在wordpress管理编辑器中,我将我的网站从http更改为https。

3 个答案:

答案 0 :(得分:0)

尝试使用以下代码从http重定向到https

  RewriteCond %{HTTPS} off
  RewriteRule ^(.*)$ https://www.example.org/$1 [R,L]

答案 1 :(得分:0)

创建一个新的.htaccess文件,其默认规则为wordpress&gt;&gt; 在Cpanel重定向选项中,配置从http到https的永久重定向,有或没有www&gt;&gt;您可能还需要使用wordpress插件,将适当的ssl安全性应用于图像和帖子

然后检查。

答案 2 :(得分:0)

请你修改.htaccess中的https规则

 RewriteEngine On 
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

并且还要进行wordpress设置和chnage域重定向 http://example.comhttps://example.com