Automtically creating new redirects and alias on node_save Here is the code I'm using to change the name field of my nodes if they contain certain phrases. 

$query = new EntityFieldQuery();
$query
    -&gt;entityCondition('entity_type', 'node')
    -&gt;entityCondition('bundle', 'my_product')
    -&gt;fieldCondition('field_my_name', 'value', 'Old Phrase%', 'LIKE');

foreach ($result['node'] as $key =&gt; $value) {
    $node = node_load($key);
    $node-&gt;field_my_name[LANGUAGE_NONE][0]['value'] = str_replace('Old Phrase', 'New Phrase', $node-&gt;field_my_name[LANGUAGE_NONE][0]['value']);
    node_save($node);
}


It successfully changes the name; however, I'd like to automatically create a new URL and also a redirect entry from the old URL to the newly generated one. 

I have pathauto installed and my URL Alias is configured to use the my_name field, but the code above does not change the Alias.
Pathauto should automatically create a new alias with the updates (unless you have it turned off on the node). pathauto.module lines 519-522:

// Skip processing if the user has disabled pathauto for the node.
if (isset($node-&gt;path['pathauto']) &amp;&amp; empty($node-&gt;path['pathauto'])) {
  return;
}


The Global Redirect module can then provide 301 redirects to the new URL alias.