redirecting legacy URLs to corresponding drupal path I'm planning to migrate the content from my existing legacy system to drupal. In process there are a lot of static pages, nodes and taxonomy terms which have hyperlink references to the legacy URLs that cannot be replaced with current URLs due to their sheer magnitude and for which redirects cannot be set manually (i'm using path_redirect module to handle redirects, atleast I intend to).

So my idea of implementing this by redirecting my legacy URLs in my .htaccess to handle them in a custom module where the drupal URL is deduced based on the URL and its params and redirect them. Also add an entry for them with HTTP 301 in path_redirect table so that next request I could check for the entry before proceeding to programmatically determine the node/page URL again. I skimmed the module code which seemed to use hook_init to work the redirections and it seemed feasible in theory, though i'm not sure of the results in practice.

Hence I wish to know if this idea is sensible or if it has some flaws as I'm not an expert in the areas of URL rewriting or SEO. Also I'd request anyone with practical experience on the same to know of any challenges involved in this.This served as a reference before I decided to post my query.
I've just done a transition like you mentioned and the domain names changed. I didn't want the old urls hitting my drupal server so I setup a 2nd site just for redirects. At first I had a simple php redirect script that would map old urls to Drupal urls. The mapping came off the "migrate_map" tables that the migrate module generated.

Then someone on the team was concerned about the immediate SEO impact and preferred to keep the old site content available at the old domain name. So I copied the new Drupal site to a 2nd hosting account.

I added a "custom404" module which uses hook_init() to read the URI, detect a pattern, find the unique key in the uri, then lookup the Drupal nid using the migrate_map table and then use drupal_goto() to do a 301 to Drupal URI. 

On that Drupal site I show a "website has moved" message with a link to the same URI on the new domain. Pretty soon I'll change my script to just 301 redirect to the new domain directly.

I was initially toying with the idea of using a lower bootstrap level (to have faster redirects) but ran into issues with database connections. Got some great help here about that.