首页 文章

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

提问于
浏览
2

有一个magento多站点设置,3个域 .

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

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

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

迈克尔斯代码在这里......

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

    更改特定存储范围的Magento配置中的不安全基本URL对您来说是一个相当大的选择吗?只有在您希望成为所有应用程序(Magento)请求的https域的范围内 .

相关问题