当在地址栏中输入http时,帖子/页面不会重定向到Https


Posts/Pages are not redirecting to Https when type it with http in addressbar?

最近我在我的网站上安装了SSL并将其从http://copybloggerthemes.com重定向到https://copybloggerthemes.com

问题:当我在地址栏中使用http写post url时,它不会重定向到https。

示例:这是我的帖子:http://copybloggerthemes.com/straight-blogger-template/只需复制此url并在地址栏中传递它。您将看到它没有重定向到https。你可以像这样检查任何帖子或页面的url。

也注意:只有主页工作。当我进入这个http://copybloggerthemes.com,然后它重定向到https://copybloggerthemes.com,但不是为帖子和页面。为什么?

我在底部的.htaccess文件中添加了这段代码。

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.copybloggerthemes'.com$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^ https://copybloggerthemes.com%{REQUEST_URI} [R=301,L]
现在,我希望有人能在这方面帮助我。我犯了什么错误?

谢谢。

在你的HTACCESS文件中使用这些规则。这将处理通过HTTPS提供的www和非www url。此外,域名的www版本也将被301重定向到非www。

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www'.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]
# for non secure URLs without the www
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^(www'.)(.*) [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

应该告诉你如何在模板中设置你的网站url。设置Wordpress站点URL

希望这对你有帮助。汤姆,把