The site in question was moving to a new shopping cart, which of course meant all of the URLs were going to change. Not the best thing to do in any case, but in this one it's was pretty much a requirement. They'd outgrown the capabilities of the older cart, not to mention that it had a really badly optimized database structure that would likely cause unnecessary server load as traffic levels increase. And there simply weren't the funds available to build a custom cart application around the old URLs.
In a nutshell, the old urls looked like:
and
http://www.domain.com/index.php?maincat=16
and
http://www.domain.com/display_page/php?i=3
Even though the site is not overly large (around 300 pages) forcing Apache to parse through a large .htaccess file for every page request would not be the way to approach it IMO. To do standard 301's for all of the various category and manufacturer pages would end up looking something like:
RewriteRule ^index\php$ http://www.domain.com/category/Category_Name/c72 [R=301,L]
Not too bad when you look at just one redirect for one page migration. But when you're looking at 100 or more you're asking Apache to do a lot of heavy lifting and putting undue strain on the server.
A better solution is simply to let PHP do the heavy lifting. It's much better for the server, and a scripted solution would limit when the redirects fired since all of the old pages were tied to either index.php or display_page.php.
So what was the solution?
Simple really. The old index.php page was replaced with a scripted redirect page, where the php code analyzed the query string, compared it against an array of possible values, then assigned the correct value to the redirect. We were also able to easily insert some error handling since a couple of manufacturers/categories were going bye-bye.
Because it's contained at the file level, Apache doesn't get bogged down. In fact, nothing kicks in at all unless someone/something accesses one of those two affected files. Bottom line, instead of having a .htaccess file that was a couple hundred lines long and would have to be processed for every file request, the .htacess file contains only a few lines to handle www/non-www issues.