Skip to content

Backwards-compatible URLs in Drupal

August 31, 2010

Last week, I wrote a therapeutic post about our effort to provide backward-compatibility in the next version of a website, saying that I’d post again with notes on how we ended up solving the problem. This is that post.

To recap, we have almost 800 URLs on the current version of a site that are in the format of

http://www.example.org/foo.asp?foo=123

These URLs are all going to have to redirect (via 301 redirect if possible) to a URL like

http://www.example.org/node/839

In the end, we’ve used the Drupal module path_redirect, which offers the ability to provide everything we need. I wrote a simple script that looked up all 750+ records from the old CMS that powers the current/old website, and populated the path_redirect table in our Drupal database with those shortcuts, and the node/NID path for the new locations. The redirects are set up to respond with 301 Moved Permanently status codes.

I thought this was going to be the project which forced me, finally, to come to grips with regular expressions and some new (to me) Apache directives, but in the end the prospect of building database queries within httpd.conf had me running back to the beast I know (better).

The new site launches later this week, so I’m keeping my fingers crossed.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: