转发到错误的图像存储


Forward to wrong magento store

这是我在Magento的index.php中切换存储的代码:

if ($url['host'] === 'five-oaks-int.eu') {
    if ($geoplugin->countryCode === 'CH') {
        header('Location: http://schweiz.five-oaks-int.eu');
        exit;
    }
    Mage::run('five_oaks_german', 'store' );
} else {
    Mage::run('default', 'store');
}

如果我调用url five-oaks-int.eu,则magento加载的不是存储five_oaks_german,而是默认存储。浏览器中的url更改为默认存储的url。

为什么显示magento不调用five_oaks_german?商店设置url似乎是正确的。

你能发布$url的输出吗?

不过,最好的方法是使用MAGE_RUN_CODE并在vhost中设置它(如果您使用Apache),或者如果您使用Nginx则使用"map"。

在Apache中,如果你不能访问vhost:,你可以使用.htaccess来实现这一点

SetEnvIf Host .*five-oaks-int.eu.* MAGE_RUN_CODE=five_oaks_german

取自:http://devdocs.magento.com/guides/v2.0/config-guide/multi-site/ms_apache.html

如果你在Nginx上,那么你可以使用"地图"-请参阅http://devdocs.magento.com/guides/v2.0/config-guide/multi-site/ms_nginx.html