如果没有www,并且使用https://而不是http://,我无法使我的WordPress网站初始加载。
我将WordPress永久链接设置为"帖子名称",因此url看起来像"https://example.com/sample-post".我还将"WordPress地址(URL)"answers"网站地址"更改为"https://example.com".
我将此添加到wp-config.php中:
define( 'FORCE_SSL_ADMIN', true );
什么都不管用。
我做的一件事是把它添加到。htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
</IfModule>
# 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
它最初会将我的网站加载为www.example.com,然后在3秒钟后将其更改为https://example.com.这似乎是一个奇怪的破解。
我错过了什么?如何使用https://
将其添加到.htaccess文件中
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www'.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]