Redirect your product URL:s in Episerver Commerce

Why redirect?

A very good thing about Episerver Commerce is that even you enabled the partial routing system, the old SEO Uri:s will continue to work (of course, as long as you keep the Uri:s unchanged). So they can coexist in same website – but that might not what you want – you might want to stick with only one routing system – it’s been told that the more popular your URL is, the higher rank it gets in the search engine results.

From hierarchial URL to SEO URL:

This one is pretty easy, just call this during your site’s initialization, the true parameter means you want to enable Outgoing Seo URI, and the next statement configures the redirect:

CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, true);

CatalogRouteHelper.SetupSeoUriPermanentRedirect();

From SEO URI to hierarchial URI:

This one is tricky, there is no such built-in method allows us to do so. We can’t even override SeoUriRouter because it’s registered automatically and there is no way to guarantee that our router will be able to run before it. (If a matching router is found, the processing will stop).

Continue reading “Redirect your product URL:s in Episerver Commerce”