它被问了无数次,但在我的Wordpress中仍然不起作用。我想将所有内容重定向到https://website.com.已使用的当前代码:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
</IfModule>
基于this one 但我也试过了all in this page 当然还有this other one. 也许我错过了什么,但无论我尝试什么组合,都会发生这种情况:# http://website.com -> https://website.com
# https://website.com -> https://website.com
# http://www.website.com -> https://www.website.com #wrong#
# https://www.website.com -> https://www.website.com #wrong#
我开始怀疑let’s encrypt安装是否与。。。或者甚至在wp config中进行一些其他修改。php。。。我在过去补充了这一点:if ( defined( \'WP_CLI\' ) ) {
$_SERVER[\'HTTP_HOST\'] = \'localhost\';
}
define(\'WP_SITEURL\', \'https://\' . $_SERVER[\'HTTP_HOST\'] . \'/\');
define(\'WP_HOME\', \'https://\' . $_SERVER[\'HTTP_HOST\'] . \'/\');
有什么想法吗?谢谢