Mapping a previously used ID to a NID
Let's say that the old URL looked like http://example.com/index.asp?id=123, but your new Drupal site uses a URL like http://example.com/node/123. The following rules could be used to remap the old URL unbeknownst to the user. The following examples would be placed before the Drupal rewrite rules in your .htaccess file:
# Match a request for index.asp
RewriteCond %{REQUEST_URI} ^/index.asp$
# Match a query string like id=[some number] and capture that number
RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
# Rewrite a Drupal friendly URL using the captured number
# Note that %1 is a backreference from a RewriteCond
# where $1 is a backreference from a RewriteRule
RewriteRule ^.*$ index.php?q=node/%1 [L]
Mapping a previously used numeric file name to a NID
Perhaps your former CMS creates static HTML files, but uses an ID predictably in the file name. The following example will capture any numeric characters in parentheses and append them to index.php?q=node/. e.g. requesting file5.html would return the same contents as node/5.
# Map a filename with a predictable number to a drupal nid
RewriteRule ^file([0-9]*)\.html$ index.php?q=node/$1 [L]
Redirecting as a solution
If you want to send your visitors to the correct page and use your new Drupal-style URLs, you can use a permanent redirect. The 301 HTTP status code tells your visitors that the old URL has a new permanent home. Search engines should also respect a 301 and index appropriately. Using the RewriteRules above, you could accomplish this by using the flags [R=301,L], demonstrated below:
# Match a request for index.asp
RewriteCond %{REQUEST_URI} ^/index.asp$
# Match a query string like id=[some number] and capture that number
RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
# Permanently redirect - note the ? at the end of the address
# which is necessary to not append the original query string
RewriteRule ^.*$ http://example.com/node/%1? [R=301,L]
The above example will redirect the user to a URL like /node/123. So, what if you want to permanently redirect to a more friendly URL alias? A great option is to use the Global Redirect module for Drupal.
Global Redirect can also be used in conjunction with mod_rewrite rules. (The first set of mod_rewrite rules mentioned in this post are a good example) Assume that you have a URL alias like /your-aliased-url used for /node/123. Using mod_rewrite, you can map /index.asp?id=123 to /node/123 and Global Redirect will permanently redirect to your alias. This effectively sends all requests for /index.asp?id=123 to /your-aliased-url.
Source: http://acquia.com/blog/migrating-drupal-way-part-ii-saving-those-old-urls