So you've got your blog all set up. You've installed the Pathauto module and set your blog posts to have an alias of (for example):

/content/my-new-blog-post

You already have 25 posts and are ready to let it out there for all the world to see.
While surfing around the web, you realize that lots of other blogs have their URLs formatted as follows:

2009/02/31/my-new-blog-post

And you, of course want to have those cool date-style aliases, too!

What to do?

  1. Go to the URL alias admin screen: Home » Administer » Site building » URL aliases.
  2. Go to the Delete aliases tab at the top, and delete the aliases that you want to change. Note: This will NOT delete the posts, it will only delete the aliases - i.e.: it will revert the post's URL from /content/this-is-my-blog-post back to /node/25, the default Drupal path.
  3. Go to the Automated alias settings tab, open the Node path settings tab and put in the path format you want (in this case: [yyyy]/[mm]/[dd]/[title]) in the field of the appropriate content type (in this case: blog post).
  4. Check the Bulk generate aliases for nodes that are not aliased checkbox.
  5. Click Save configuration at the bottom of the page.

Now that all of your aliases have been deleted, the Bulk generate option will create them all again - this time in the format you want. It doesn't overwrite existing aliases, so you have to delete the 'wrong' ones, before it will remake them.

Another Option

At Administer, Content (admin/content/node) select all the nodes whose path you want to rename. In the Update Options drop-down list select Update Path Alias then click the Update button.
This should work for Drupal 5 and Drupal 6.

Comments

GreenReaper’s picture

Sometimes you want to change to a new format but keep the old links valid, because pages still link to them.

You can do this by getting the latest version of pathauto (6.2, currently an alpha version), selecting to convert existing aliases to redirects on update in the options panel, modifying the SELECT statement [node|forum|whatever]_pathauto_bulk_update_batch_process in pathauto.pathauto.inc to remove "ua.src IS NULL AND", then running a bulk alias update on the selected node type. Because you modified the select, the aliases will be recreated even though they exist.

innovationcreation’s picture

Current setup: I use Drupal 5.x and have had Pathauto (using 5.x-2.2 currently) installed for a year or two.

Goal: I now need to create new set of aliases for all the nodes to help support Google News requirements (Display a three-digit number. http://www.google.com/support/news_pub/bin/answer.py?hl=en&answer=68323 ).

Deleting the existing aliases is not an option.

Thoughts and guidance appreciated.
John Blue
Twitter @TruffleMedia

Prodigy’s picture

The methods above only do a small amount at a time.

Suppose you have 4,000 nodes that need re-aliased. The methods described above will not batch update your aliases.

  • Option One
  • Install Views Bulk Operations and use Drupal's Batch API to bulk update your nodes paths.

  • Option Two
  • Use Drush and run the command below.
    drush php-eval '_pathauto_include() ; node_pathauto_bulkupdate()'

  • Option Three
  • Use a custom script as described here as well as others.