【问题标题】:magento https/http redirectionmagento https/http 重定向
【发布时间】:2011-05-25 20:39:20
【问题描述】:

有没有办法根据 magento 中的参数重定向域。

例如:

如果用户尝试加载https://stage.domain.com/,系统应将其重定向到 http://stage.domain.com/,

如果用户尝试加载https://stage.domain.com/all_access_profile,系统应将其重定向到http://stage.domain.com/all_access_profile

但其余的可以转到用户实际请求的实际链接。

我从@stackoverflow 得到了这个

RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

这个总是重定向。需要如何更改以获取基于 url 参数的重定向。

谢谢

【问题讨论】:

    标签: mod-rewrite magento url-rewriting apache-config magento-1.4


    【解决方案1】:

    您想从安全 (https) 重定向到不安全 (http),但重写规则 http%1 指向安全。这是错误的方式,所以应该是:

    RewriteCond %{HTTP_HOST} !^www\.
    RewriteCond %{HTTPS} ^on
    RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    

    【讨论】:

    • 哦,是的,谢谢,但这里还有一个问题是实际的 https 链接应该是 https。通过使用这种方式,它将所有内容重写为 http。 Magento 默认将所有内容重写为 index.php {RewriteRule .* index.php [L]} 但是当我们输入错误的 url 时,这个重写 url 不起作用。页面损坏而不是 404。
    猜你喜欢
    • 2013-04-09
    • 2011-02-04
    • 2017-01-17
    • 2011-09-06
    • 2018-08-13
    • 2018-08-29
    • 2016-10-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多