0
votes

I followed this post and this in order to test create a custom routing entry for an item. I tried to register a route in global.asax something like this...

 void RegisterRoutes(RouteCollection routes)
    {
        routes.RouteExistingFiles = true;
        routes.MapPageRoute("about", "about/us", "~/About/Company", false);
    }

but the unfortunate thing is, this results in 404. I think the asp.net routing is looking for a physical page "About/Company.aspx" where as it is more of a rendered page/link out of sitecore/content/site/about/company in the sitecore tree. Do you know if there is way to redirect it to a rendered sitecore url/item?

1

1 Answers

2
votes

Using Routing to do this is possibly not the most optimal solution.

The easiest way of mapping URLs to a specific item is by setting up Aliases. See chapter 6.1 in the Data Definition Cookbook for more information about Aliases.

If you need more control you could create a custom ItemResolver that can sit after the default ItemResolver in the HttpRequestBegin pipeline and can run your custom URL/item mapping.