【发布时间】:2015-03-05 23:13:27
【问题描述】:
如果用户在购物篮中或在订购过程中,我会尝试重定向到 https(并返回)。
我尝试了很多 - 但它不起作用:
# if ssl off and basket|order -> https
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (?:basket|order)
RewriteRule ^ https://www.example.com%{REQUEST_URI} [R=301,L]
# elseif ssl on and !basket|order -> http
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !(?:basket|order)
RewriteRule ^ http://www.example.com%{REQUEST_URI} [R=301,L]
示例网址:
错误:http://www.example.com/basket.html 正确:https://www.example.com/basket.html
第一个(如果)部分单独效果很好 - 但放在一起就很糟糕!
非常感谢!
【问题讨论】:
标签: .htaccess mod-rewrite redirect ssl https