How can I preserve nids during a migration? I'm writing a migration using migrate/migrate_d2d to import nodes from one Drupal 7 installation to another.

Currently there are a lot of links on the web that point to articles using the example.com/node/[nid] url. Since the site I'm importing to will eventually replace the current one, I need to make sure those links still point to the correct articles.

How can I preserve nids during the migration, so that the old links that use /node/[nid] still point to the correct articles?

Alternatively, how can I easily make 500,000+ URLs to old nids redirect to their newly migrated counterpart?
This is actually easy to do. In the prepare() function of the node migration class, just set the nid and is_new to true:

public function prepare($node, $row) {
  // Preserve old nid so that old links to nodes using /node/nid still work
  $node-&gt;is_new = TRUE;
  $node-&gt;nid = $row-&gt;nid;
}