在url Magento中添加自定义变量

时间:2014-03-27 12:18:53

标签: 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 Dutch (NL) but the country is Belgium (BE), the URL should become;
    http://www.domain.ext/nl_bel/category.html

我有国家代码的价值,我想知道如何实现它。任何帮助都非常感谢。

2 个答案:

答案 0 :(得分:0)

使用 .htaccess重写规则

HTH

答案 1 :(得分:0)

嗯,如果你不知道怎么用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';
}

这将允许您使用内容为/ nl /

的新网址(/ nl_nl /)