当前位置: 动力学知识库 > 问答 > 编程问答 >

Magento categories as subdomain

问题描述:

Is it possible to create urls for category as subdomain, for example now it is:

mystore.com/category

I would like it to be

category.mystore.com

I know there is multistore option, so I could create more websites and set root directory for every category, but there would be problem with cart sharing, next thing is site is has 2 languages - so I'm using multi store for site translation

网友答案:

There's no way to achieve this out of the box, but this can be done using a custom router. Create a custom router and insert it before the standard router. In your custom router, check the subdomain of the request. If it matches a category URL key (or whatever other criteria you'd like to use), rewrite the request to that of a standard category page (i.e. /catalog/category/view/id/123/). Keep in mind that your users will probably leave the subdomain when they click on a link because your base URL will not include the category-specific subdomain. Take a look at Mage_Cms_Controller_Router as an example of a custom router.

分享给朋友:
您可能感兴趣的文章:
随机阅读: