Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using migrate to import a bunch of nodes and I want to set the path alias during the migration. I am able to import the path alias just fine like so:

$this->addFieldMapping('path', 'url_alias');

When I look at the imported nodes I see the correct path in the path field, but the Generate automatic URL alias checkbox is still checked which means the setting is getting ignored.

How do I disable that setting on the node during migration?

share|improve this question
up vote 9 down vote accepted

You basically need to make sure the $node object is passed in with pathauto set to false when it is saved.

In your migration class:

function prepare(&$row) {
  $row->path['pathauto'] = 0;
share|improve this answer
I tried that, but the Generate automatic URL alias is still checked. – Kenny Wyland Nov 22 '12 at 17:39
But I tried your suggestion in the prepare() method instead of prepareRow() and it worked! If you edit your post then I'll accept it as the answer. Thanks! – Kenny Wyland Nov 22 '12 at 17:44
Edited--got the wrong method the first time around :) – jhedstrom Nov 24 '12 at 7:22

Works for me. Pathauto: Perform aliasing (set to 0 to prevent alias generation during migration See 'drush ma' + name of your class for full description

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.