Try our conversational search powered by Generative AI!

Manually Adding URLs to the URL Rewriter

Vote:
 

I have a couple Web forms on a site that don't correspond to content objects in the system.  So, they're not templates mapped to Page Types, they're just .aspx files sitting in the root of the site.

I'd like to clean up the URLs to these files.  Is there an easy way to add one or two URL patterns to EPiServers' URL re-writer?  I don't want to re-implement the whole thing -- just add a couple patterns to random Web forms.

#32627
Sep 09, 2009 21:15
Vote:
 

There is 3 different ways you can achieve this:

  1. Use UrlRouting in ASP.NET - simply turn on the httphandler for urlrouting and register the routes on startup.
    Good: Routing is cool and you can match on patterns of urls
    Bad: Requires a bit of coding - Including your own webform handlers
    Read more http://labs.episerver.com/en/Blogs/Allan/Dates/112230/11/EPiServer-and-Custom-URLS-using-ASPNET-UrlRouting/
  2. The easy way - use the mapping functionality of virtual paths. Turn on the virtualpathmapped provider in web.config and in the mapping section specify source url and destination.
  3. You could also either hook onto the events of the UrlRewriter and do it there - or extend the urlrewriter with your own (that perhaps inherits the current). Not a very clean or nice solution though - and will require a significant amount of error-prone coding.
#33249
Edited, Oct 05, 2009 21:09
Vote:
 
#34388
Nov 05, 2009 12:58
Vote:
 
#34389
Nov 05, 2009 12:58
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.