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

  • Home
  • SEARCH
  • 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 8497127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:02:34+00:00 2026-06-11T00:02:34+00:00

How to programmatically bulk alias node urls by using only drupal 7 core (with

  • 0

How to programmatically bulk alias node urls by using only drupal 7 core (with it’s great batch API !)?

My question is actually how to make drupal use and recognise the aliases stored in url_alias table?

Background:

The project I work on has more than 200,000 nodes (Drupal 7) and aliasing the system default url of all those nodes would literally take years with pathauto module (10 aliases every 20 minutes). I tried everything to improve those performances but failed (tried different servers, different mysql optimisations, different patterns).

I have already the batch process functions up and ready, they alias 200,000 nodes in 20 minutes, they create clean aliases stored in table “url_alias”.
I took lots of time looking at pathauto code, but couldn’t find or understand how the module was giving drupal the order to recognize the bulk updated paths.

Thank you for your hints, answers or ideas..much appreciated!

  • 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-06-11T00:02:36+00:00Added an answer on June 11, 2026 at 12:02 am

    Here is function that will update aliases for all nodes of specified type

    <?php
      module_load_include('inc', 'pathauto');
      module_load_include('inc', 'pathauto.pathauto');
    
      // Get all nodes that need to be updated
      $query = db_select('node', 'n');
      $query->addField('n', 'nid');
      $query->condition('n.type', array('TYPE1', 'TYPE2'), 'IN');
    
      $nids = $query->execute()->fetchCol();
    
      // Save current action for new aliases and change it to delete old one.
      $alias_action = variable_get('pathauto_update_action', 0);
      variable_set('pathauto_update_action', PATHAUTO_UPDATE_ACTION_DELETE);
    
      pathauto_node_update_alias_multiple($nids, 'bulkupdate');
    
      // Restore original action for new aliases.
      variable_set('pathauto_update_action', $alias_action);
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how can I programmatically set the system volume for voice call when using a
does anyone know howto programmatically show and make the field editable for tracking number
I have a programmatically created Storyboard (as I only use it for iOS 5)
Programmatically I am creating buttons and keeping some background image using setBackgroundImage. I want
When programmatically adding user controls using LoadControl(string path), when, in the user control's page
I saw that programmatically turning bluetooth on and off was a private api thing
How to programmatically install Windows Media player using .net. Windows media player is not
In programmatically building cubes for SQL Server Analysis Services using AMO, I've discovered that
How programmatically extract enumeration constraint values of an element from xsd schema file using
Tell me how to programmatically assign a position to a button in android using

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.