I need to setup some permanent redirecting in EPiServer 7.5, but what is the recommended approach? I have read Joel's article (http://joelabrahamsson.com/custom-routing-for-episerver-content/) about partial routing and segments and I was leaning towards using the segment-approach, but I am not sure it is the correct approach.
Creating an HTTPHandler could also be an option?
The urls looks similar to this:
and the new url is:
Basically, the parameters of the 'old url' have been turned into segments in the new url and the page to redirect to is placed differently in the page hierachy.
Does it make sense?
I would suggest that you use routes.
Most of the time I think it's easier for you to determine your rules by code than to setup handlers in config.
If this is an existing solution, you should also have SEO in mind - old urls should return 301 Moved Permanently.
It is an existing site, so you are right Mari it should return a 301 moved permanently.
Any suggestions on which approach to take? Is HttpHandler the correct way then?
It may be that you could use Rewrite Module for IIS - a rewrite can be setup with type permanent, see:
You could also use the 404 module - see https://www.coderesort.com/p/epicode/wiki/404Handler
The module supports xml import of redirect rules in format:
Thank you for the suggestions.
We are already using the 404-module, but in this case it is more than 1000 URLS that we need to remap, so I am not so keen on the xml import approach due to the risk of errors happening (typing). Additionally, I already got some code in place that can parse the old URL into an object, which should make it easier to map into the new URL.
I ended up just adding a route and implemented an IRouteHandler, like:
RouteTable.Routes.Add("ROUTENAME", new Route("ROUTEURL", new IRouteHandlerImpl));
ROUTENAME = name of route
ROUTEURL = url-pattern to match
new IRouteHandlerImpl = implementation of the interface IRouteHandler