Node Migrations with programmatic url aliases Can anyone advice me on how to programmatically create multiple url aliases for each row of a migration?

I am using the Migrate module to migrate page content into Drupal from an XML document.

The existing system has multiple url alias data for each page and I need that same information represented in Drupal - which is proving to be challenging.

I tried doing the following in the complete function of my custom migrate class:

function complete($entity, $row) {
    // drush_print_r($entity);
    // Create an object with our redirect parameters
    $redirect = new stdClass();
    $redirect-&gt;source = "node/{$entity-&gt;nid}";     // From URL
    $redirect-&gt;source_options = array();
    $redirect-&gt;redirect = 'http://www.google.com';        // To URL
    $redirect-&gt;redirect_options = array();
    $redirect-&gt;status_code = 0;            // Redirect Status, 0 is default
    // $redirect-&gt;type = 'redirect';
    $redirect-&gt;language = LANGUAGE_NONE;
    // Create the redirect
    redirect_save($redirect);

 /****************** **I also tried the following** *******************/
    // $entity-&gt;path['alias'] = 'test/testing';
}


I then carryout a sample migration but my url redirects are not present in the node edit area.

Can anyone help, please?
If I understand correctly, based on your example, you'll need to switch the to and from URLs. If you want the new node to display the redirects in the node edit form, the node ID should be as follows:

$redirect-&gt;redirect = 'node/' . $node-&gt;nid;


FYI - programmatic redirect creation here.