【发布时间】:2016-10-26 14:22:59
【问题描述】:
我需要使用 apache 服务器将所有流量从 http 重定向到 https。我想保留我的实际重定向(不带 www -> 带 www)
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule (.*) https://www.domain.com/$1 [R=301,L]
有了这个 htaccess,我有 http->https 重定向,没有 www->有 www 重定向,但不要同时进行。
我需要这个重定向:
http://domain.com -> https://www.domain.com
http://domain.com/foo/bar -> https://www.domain.com/foo/bar
谢谢
【问题讨论】: