Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6685059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:00:47+00:00 2026-05-26T05:00:47+00:00

I have migrated nodes using migrate module v2. Currently i am running into a

  • 0

I have migrated nodes using migrate module v2. Currently i am running into a problem that the previous site used url aliases,which have not been migrated into drupal7 and will affect the site rank from SEO perspective.

Is there a way i can migrate the path aliases while running the migration classes itself?If not what would be the best way to do so?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:00:48+00:00Added an answer on May 26, 2026 at 5:00 am

    The best way (according to me) to have the same url aliases is :

    1> install url_alias module.

    2> configure the nodes with patterns similar to drupal6. Now, this step may trouble you, in case the new url-aliases have nids attached to them.(as in my case).

    As a solution we can go ahead and create custom tokens using code where the source id can be fetched from the migrate map tables based on the new destination ids which are easily available.

    Now, we can go ahead and bulk generate url-aliases.

    An example for creating such custom token would be:

    /**
     * Implements hook_token_info().
     */
    function custom_configuration_token_info() {  
      $type = array(
        'node' => array (
          'name' => t('Nodes'), 
          'description' => t('Tokens related to individual nodes.'), 
          'needs-data' => 'node',
         ),
    
             'term' => array(
               'name' => t('Taxonomy Terms'),
               'description' => t('Tokens related to taxonomy terms.'),
               'needs-data' => 'term',
             )
          );
    
          // tokens for node legacy nid.
          $tokens['node']['mapid'] = array(
            'name' => t("mapid"), 
            'description' => t("The nid of the node prior to migration."),
          );
    
          $tokens['term']['mapid'] = array(
            'name' => t('mapid'),
            'description' => t('The tid of taxonomy terms prior to migration.'),
          );
    
          return array(
            'types' => $type, 
            'tokens' => $tokens,
          );
        }
    
    
        now,
    
        function custom_configuration_tokens($type, $tokens, array $data = array(), array $options = array()) {
          $url_options = array('absolute' => TRUE);
          if (isset($options['language'])) {
            $url_options['language'] = $options['language'];
            $language_code = $options['language']->language;
          }
          else {
            $language_code = NULL;
          }
          $sanitize = !empty($options['sanitize']);
    
          $replacements = array();
    
          if ($type == 'node' && !empty($data['node'])) {
            $node = $data['node'];
    
            foreach ($tokens as $name => $original) {
                  switch ($name) {
    
        <write your custom code for the token conditioned by the name attribute in info function>
    
            }
          }
        }
    

    While writing your custom code, you mite also be needing the legacy table. Drupal 7 supports multiple databases, so just configure the legacy table credentials in settings.php file.

    Use drupal_set_active while fetching data from the different tables.

    Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Table Wizard + Migrate module to import nodes into my Drupal installation.
I am using the Drupal 7 Migrate module to create a series of nodes
I have a solution containing several projects that have migrated from VS 2003, 2005,
We have just 'migrated' an SQL Server 2005 database from DEVEL into TEST. Somehow
I have a large quantity of clearcase data which needs to be migrated into
I have this piece of code that works fine in subsonic 2.2, I migrated
I have an application that currently stores timestamps in MySQL DATETIME and TIMESTAMP values.
Firstly, I have migrated my CVS repository into SVN repository. I checked out this
I have a 3rd party JAR file that is compiled using Java 1.4. Is
Recently I have migrated my project from SQLServer 2000 to MySQL 5.2 using MySQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.