使用 apache rewrite 将 http 自动跳转到 https 时,想要在输入 xxx.com 时自动跳转到 www.xxx.com.
RewriteEngine on
RewriteCond %{http_host} ^wxncsyyh.com [NC]
RewriteRule ^(.*)$ http://www.wxncsyyh.com$1 [L,R=301]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}$1 [L,R]
使用以上配置时,可以实现 http 到 https 的跳转。
访问 http://xxx.com 时可以跳转到 https://www.xxx.com,
但是访问 https://xxx.com 时无法跳转到 https://www.xxx.com,
请问应该如何配置?