URLMapping or URL Rewriting

URLMapping or URL Rewriting as is is sometimes called, is very important to make your site people and search engine friendly.  The later releases of DotNetNuke included this functionality, which is important because DotNetNuke tends to not be search engine friendly at all and I can prove this with my sites.  This is one of the reasons I decided to abandon it, but that is another story.

Anyway, I found several blog entries around the net on URL Mapping in ASP.NET 2.0.  I found it to be extremely easy.  Scott Guthrie has a quick entry that reminded me of this.  So does Fritz Onion, Microsoft, and finally the big one that contains Regular Expression URL Mapping.

Anyway, I love this stuff.  Here is an example of how I have my web.config setup to map some static content pages to the correct page to handle these URLs.  It works like champ!  Christopher Pietschmann's Blog has the code you will need to create the underlying classes.


<add type='RegExUrlMapping_HTTPModule.RegExUrlMappingModule' name='RegExUrlMappingModule' />


<!-- The RegEx URL Mapping parser goes through these in sequential order. -->

RegExUrlMapping enabled='true'>

<add url='~/t/(.*)/default.aspx' mappedUrl='~/content.aspx?PageName=$1' />


Share This Article With Your Friends!