在url Magento中添加自定义变量

在url Magento中添加自定义变量,magento,Magento,我想在商店代码后添加国家名称。比如说 The current URL for a category for the dutch store view would be; http://www.domain.ext/nl/category.html If the country is set to NL the URL should now be; http://www.domain.ext/nl_nl/category.html If the storeview is Dut

我想在商店代码后添加国家名称。比如说

The current URL for a category for the dutch store view would be;
      http://www.domain.ext/nl/category.html
 If the country is set to NL the URL should now be;
   http://www.domain.ext/nl_nl/category.html
If the storeview is Dutch (NL) but the country is Belgium (BE), the URL should become;
    http://www.domain.ext/nl_bel/category.html
我有国家代码的价值,我想知道如何才能实现它。非常感谢您的帮助

为此使用.htaccess重写规则


HTH

嗯,如果您不知道如何使用htaccess进行重写,您可以这样进行php重写:

// First make a redirect in the Router Controller to new "/nl_nl/" URL, Then:

if(strpos('/nl_nl/', $_SERVER['REQUEST_URI']))
{
     $_SERVER['REQUEST_URI'] = $this->getBaseUrl() . '/nl/category.html';
}

这将允许您使用新的URL/nl_nl/和内容oft/nl/

如何跟踪国家??我包括库以获取用户国家。我只想在分类页面中使用它。我检查app/code/core/Mage/core/Controller/Varien/Router/Standard.php的匹配函数。但是没有找到任何解决办法是的,你走对了。首先使用htaccess创建重写规则,以便/nl_nl/与/nl/到达相同的URL-这很重要,否则您将创建重复的内容,而google讨厌这样做!之后,使用路由器捕获请求,与您执行此操作的方式完全相同,并将当前URL/nl/重定向到新URL/nl_nl/-非常容易通过覆盖目录模块的路由器对其进行编辑?我无法使用htaccess,因为我使用ip地址获取国家名称。无法通过覆盖目录模块的路由器对其进行编辑?