Magento多站点.htaccess将1站点http重定向到https

时间:2014-08-08 14:22:39

标签: apache .htaccess magento redirect https

拥有magento多站点设置,3个域。

想要安排htaccess 301将http重定向到https,仅针对3个域中的1个域的所有请求。

Michael Berkowski's answer here中的代码可以保留网址的其余部分(即将http://example.com/abc指向https://example.com/abc),但它会为多站点设置中的每个域执行此操作。

如何修改Michael的代码以便我可以指定domain1.com重定向,但domain2.com和domain3.com不重定向?

Michaels代码在这里......

RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

1 个答案:

答案 0 :(得分:0)

更改特定商店范围的Magento配置中的不安全基本URL是否适合您?只有在您希望成为所有应用程序(Magento)请求的https域的范围内。