How to set URL alias automatically for a content type WITHOUT using Pathauto? Which hook to implement? Pathauto can do the job easily for all content types, but in my case I only have one content type URL that needs to be customized, and I would prefer to not install Pathauto and Token. 

Can anyone advise me how to do?
/**
 * Implements hook_node_insert()
 */
 function mymodule_node_insert($node) {
   if ($node-&gt;type == 'mytype') {
     $node-&gt;path['alias'] = 'mytype/' . $node-&gt;nid;
   }
 }


Additionally, you may add this code to hook_node_update()