【问题标题】:Magento keeps redirecting to default website for a multisite storeMagento 不断重定向到多站点商店的默认网站
【发布时间】:2016-05-15 08:36:01
【问题描述】:

我们在 Magento 商店中有 3 个网站。 这就是我所做的。

  1. 我已将代码从实时站点下载到本地计算机
  2. 为 3 个网站设置虚拟主机

    created site1(2 & 3).com.conf and enabled them
    
  3. 在 /etc/hosts 中添加了相应的行
  4. 在我的 .htaccess 中,我有管理 3 个网站的代码

    SetEnvIf Host www\.site1\.com MAGE_RUN_CODE=site1
    SetEnvIf Host www\.site1\.com MAGE_RUN_TYPE=website
    SetEnvIf Host ^site1\.com MAGE_RUN_CODE=site1
    SetEnvIf Host ^site1\.com MAGE_RUN_TYPE=website
    SetEnvIf Host www\.site2\.com MAGE_RUN_CODE=site2
    SetEnvIf Host www\.site2\.com MAGE_RUN_TYPE=website
    SetEnvIf Host ^site2\.com MAGE_RUN_CODE=site2
    SetEnvIf Host ^site2\.com MAGE_RUN_TYPE=website
    SetEnvIf Host www\.site3\.com MAGE_RUN_CODE=site3
    SetEnvIf Host www\.site3\.com MAGE_RUN_TYPE=website
    SetEnvIf Host ^site3\.com MAGE_RUN_CODE=site3
    SetEnvIf Host ^site3\.com MAGE_RUN_TYPE=website
    

在实时服务器上一切正常,但在我的本地计算机上,当我键入 www.site1.com 或 www.site2.com 时,我会自动重定向到 www.site2.com,因为它是默认网站。

我在 Ubuntu 14.04 上我刚刚设置了整个环境(apache2、php5、mysql),因为我的机器上周已格式化。

谢谢,

【问题讨论】:

    标签: apache .htaccess magento ubuntu-14.04


    【解决方案1】:

    我的 Apache 配置似乎有问题。

    SetEnvIf Host returns an empty value
    

    我切换到在每个虚拟主机中设置值

    SetEnv MAGE_RUN_CODE "site1"
    SetEnv MAGE_RUN_TYPE "website"
    

    本地和生产之间的唯一区别是本地的 Apache 版本 2.4 和生产中的 2.2

    【讨论】:

      【解决方案2】:

      您是否更改了每个网站的 url。请检查 core_config_data 表,或者您可以在管理员中更改它。

      admin->system->configuration->general->web->(Secure and unsecure Url)
      

      【讨论】:

      • 这些是我在实时服务器中的相同 url。我保留了一切。我认为这与我的配置有关,但我无法弄清楚究竟是什么。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-21
      • 1970-01-01
      相关资源
      最近更新 更多