我无法弄清楚我的Nginx Virtualhost或/和Wordpress重写规则出了什么问题,它如下:
http://example.com-> https://www.example.com有效;
http://www.example.com-> https://www.example.com有效;
https://example.com-> https://www.example.com根本不起作用!
我尝试了尽可能多的挖掘日志。
我的Nginx虚拟主机:
server {
# Uncomment the following line for domain mapping
# listen 443;
server_name example.com;
return 301 $scheme://www.example.com$request_uri;
root /var/www/example.com/htdocs;
index index.php index.html index.htm;
include common/wpsc.conf; include common/wpsubdir.conf;
include common/wpcommon.conf;
include common/locations.conf;
include /var/www/example.com/conf/nginx/*.conf;
}
server {
# Uncomment the following line for domain mapping
# listen 443;
server_name www.example.com;
root /var/www/example.com/htdocs;
index index.php index.html index.htm;
include common/wpsc.conf; include common/wpsubdir.conf;
include common/wpcommon.conf;
include common/locations.conf;
include /var/www/example.com/conf/nginx/*.conf;
}
我的htaccess重写器:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.+)$
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
我使用https://easyengine.io/安装/配置所有内容,并从Cpanel迁移了我的WordPress网站。
我可能会错过什么?
答案 0 :(得分:0)
首先,Nginx不支持.htaccess文件。
第二,很难确定为什么它不起作用,但这是我要检查的内容:
siteurl
和home
是否设置为https://www.example.com
?