Nginx开启强制HTTPS:
if ($server_port !~ 443){ rewrite ^(/.*)$ https://$host$1 permanent; }
Nginx开启强制HTTPS访问并保留指定目录的HTTP访问:(排除wp-admin目录)
#HTTP_TO_HTTPS_START if ($server_port !~ 443){ rewrite ^/((?!wp-admin).*)$ https://$host$1 permanent; } #HTTP_TO_HTTPS_END