Backwards-compatible URLs in Drupal
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
These URLs are all going to have to redirect (via 301 redirect if possible) to a URL like
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.