Friendly Url Mapping

I just commited a new feature to svn, it will be in the next release.

It allows you to setup mappings between friendly urls and pages in the site.

For example
http://www.mojoportal.com/forums.aspx

maps to

http://www.mojoportal.com/Default.aspx?pageid=5

Try it and see

The feature works better under mono/apache than it does under IIS because of the way IIS uses file extensions to determine which isapi handler processes the request.

In IIS to use a friendly url like http://www.mojoportal.com/Forums, you have to actually create a Forums directory and put an empty text file in there named Default.aspx otherwise the request will not be handled by asp.net and you end up with a 404 error. You can use something like http://www.mojoportal.com/Forums.aspx as a friendly url in IIS without having to actually create a folder or file. Using apache/mod_mono this is not needed as long as mod_mono is set as the handler for the site directory.

Some uses of this feature include:

  • Making it easy to migrate to mojoportal without breaking urls that google may have indexed from your old site.
  • Creating friendly urls for print ads or other communications
  • Giving users who have their own blog within your site a friendly url like http://www.yoursite.com/someblogger


For those of you who are working with the source code from svn, feel free to try it out. There is an upgrade script in the folder for each data layer to create the new table and add the Feature

Comments

re: Friendly Url Mapping

Sunday, June 5, 2005 3:57:27 PM
Thanks Joe!  That's been on my wish list.

Another use of this feature is when creating links within the site itself (eg from inside a blog entry).  Instead of having to track down the page and copy the URL, I can just type the friendly URL!

--Dean

re: Friendly Url Mapping

Wednesday, June 8, 2005 9:39:26 PM
With IIS, may be you can try dir2aspx ISAPI filter. With it you can  map a directory request to default.aspx.
http://www.dotneteer.com/home/dir2aspx
Joe

re: Friendly Url Mapping

Thursday, June 9, 2005 2:12:42 AM
Thanks Michel I'll look into that and include the information when I doucument the new feature.
Comments are closed on this post.