开发者

How can I add a url path prefix to my product and category URLs in Magento?

I would like my magento category and product URLs to be something like the following:

www.example.com/products/category-slug/
www.example.com/products/category-slug/product-slug/

By default, with Catalog URL rewrites enabled, I get urls like:

www.example.com/category-slug/
www.example.com/category-slug/product-slug/

I want to keep category url rewrites enabled, for the SEO benefits.

Context:

I am building a site where I need to integrate Magento and a 3rd party content management system. I am doing this by defining a new default root block for the cms_index_default开发者_开发知识库noroute layout handle that handles non-magento pages by fetching content from the CMS (as described on this magento wiki page). By putting the catalog urls at a different url path, I avoid possible url path collisions with pages managed by the CMS.


I think you need to put the store code in the URLs - an admin setting that you can just turn on. In your htaccess you can decide how you want to play it - the 404 pages handled by Magento or the CMS.

If you want everything not handled by the CMS to be handled by Magento (which leaves you options to do things with noroute controller):

RewriteCond $1 ^(page-not-found|terms-and-conditions|projects|privacy-policy|contact|P[0-9]{2,8}) [NC]
RewriteRule ^(.*)$ /othercms.php/$1 [L]

Put your CMS 'root pages' in the ReWriteCond or do it the other way round, depending on what you have where.
Then, for your other CMS, rename index.php to othercms.php and you should be set.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜