melvek 2016-09-13 01:26 采纳率: 0%
浏览 1314

apache2 https下顶级域名跳转www配置问题

使用 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,
请问应该如何配置?

  • 写回答

1条回答 默认 最新

  • zqbnqsdsmd 2016-11-15 18:20
    关注
    评论

报告相同问题?