views:

169

answers:

2

When it comes to URL Rewriting there are some alternatives these days like the IIS7 module or Urlrewriter.NET. However, as far as I can see those two are based on wildcards which I sadly cannot use.

My problem is that the data I'm working with have no real structure. A made up example:

Something.aspx?page=4 might be /Weapons/Flails/ Something.aspx=page=5 might be /Clothes/Dresses/Blue/

i.e. there is no clear match between page id and what kind of page it is pointing to. I guess this requires some kind of lookup (slugs?) in a db.

How would I implement this in the easiest way? Does any of the existing alternatives offer a solution to this or do I have to build my own module?

Thank you.

A: 

IIS7 had a regular Expression option not just wild card it also has Rewrite maps. which i think is what you are looking for, it could be your look up table.

when you set up a rewrite rule, use the drop down to find the regEx option. also when you create the rule, the option for the map is there.

Bluephlame
It seems like an option but might be hard to maintain; the problem is that I have perhaps 80-90 urls I need to map and need to give non technical users the ability to add new urls through their application. Creating mappings for these seems cumbersome and would be easier to have in a database.
A: 

You can also use the Managed Fusion URL Rewriter and Reverse Proxy. It support the Apache mod_rewrite sytnax of configuring rewriting. And you can use this method described on my blog to create a module that can do a database lookup of these old ID's and redirect them to the correct location.

http://www.coderjournal.com/2008/12/creating-extension-module-net-url-rewriter-reverse-proxy/

Please contact me through my blog if you would like help setting up this type of rewriting.

Nick Berardi