Kev'n Roberts

Legacy URLs and RegEx

At my day job, we're in the process of an enterprise re-write. The old stuff is a hodge-podge of Cold Fusion, Java, J# and C#. The website is Cold Fusion so the URLs often look something like this:

http://www.example.com/products/product_details/index.cfm?fuseaction=foo

The new site is ASP.NET. Naturally, the URLs will look somewhat like this:

http://www.example.com/products/details.aspx?item=foo

I'm sure that many of you have been involved in a scenario like this. The business wants to update the site. But we don't want to lose all the SEO ground we've gained over the years. So we have to support the legacy URLs.

There are different ways to tackle this problem: map the ".cfm" extension to be handled by ASP.NET using a custom IHttpHandler; or use an ISAPI filter; or use a third party URL Rewriter. In the end, most (if not all) of these methods rely on Regular Expressions.

Regular Expressions are powerful, but they can be confusing, and many developers avoid them. They're like the ultra-geeky kid in school. You don't really want to associate with him, but you'd love it if he was your lab partner, because you know he'd carry you through anything that you didn't understand.

The task to write the RegExes to match the Legacy URLs with the new URLs has fallen to me. And I'm actually happy about that. The best for me to learn anything is by doing it. So I get to sink my teeth into Regex and hopefully, I won't forget what I learned anytime soon.

And now, the good part - links:

 

Posted: Apr 09 2008, 09:45 PM by kevnroberts | with no comments
Filed under:

Comments

No Comments

Leave a Comment

(required) 

(required) 

(optional)

(required)