i'm doing some migration tests since we need to migrate content from drupal 7 site A to drupal 7 site B. The only issue i have is the path auto alias, for some reason it just won't migrate. I always seem to get domain.tld/node/2122.

I already tried checking off the 'DNMG' checkbox and the other one with path, non of them seem to help.

Can somebody point me in the right direction.

Facts:

  • Path alias migrates, eg: site.tld/content/hell-world
  • Path alias and node redirects are in database: node/123 goes to site.tld/content/hello-world in the redirect screen
  • In reality 'node/123' does not redirect to the alias, even though it should be.
  • tried it with pathauto, path, redirct modules disabled, same problem
  • tried bulk updating alias, same problem.

Ik really don't know where to look anymore, i'm all doing this via the UI, since it works just fine except the url alias problem.

PS: if you post a code snippet, i need to know where to put it...

Thanks for your time.

Comments

demon326’s picture

Issue summary: View changes
Status: Active » Closed (fixed)

Fixed it, issue was the lang field...

webdrips’s picture

Issue summary: View changes

Just in case anyone finds this page through the issue search. If you have the locale module enabled, you might need to set the language to an empty string or 'und' (my choice since that's what the other aliases used) if your Drupal 6 site defined languages for some nodes, and you have locale enabled for D7, but no languages configured. (Admittedly not the best setup, but I wanted to figure out why the path was not migrating correctly.)

Here is my complete setup:

  public function __construct(array $arguments) {
    ...
    $this->addFieldMapping('path', 'url_alias')->defaultValue(0);
    $this->addFieldMapping('language')->defaultValue('');
    ...
  }

  public function prepareRow($row) {
    if (parent::prepareRow($row) === FALSE) {
      return FALSE;
    }  
    // Don't do this if you have the same languages configured on D6 and D7
    $row->language = 'und';
  }

  public function prepare($entity, stdClass $row) {
    // Don't use pathauto settings when we have a valid path.
    $entity->path['pathauto'] = 0;    
    $entity->path['alias'] = $row->path;
  }