Automatic URL aliases are not updating on Pathauto 7.x-1.3

Problem

If you have created a content type without creating a URL alias pattern at admin/config/search/path/patterns on Pathauto 7.x-1.3, when you try to update existing nodes, the URL alias won't reflect the new pattern. URL aliases will only be created for new nodes, after the path pattern has been defined.

Resolution

Using drush you can connect to the database and check if nodes for a particular content type have pathauto_state set to 0. The nodes that have a state of 0 are the nodes whose URL alias won't update. You can use drush to set the pathauto_state to 1 and you can then update existing URL aliases that will reflect your new pattern.

 

  1. Log into the database using the below command, within your site's directory within the docroot or with your specific drush alias
    drush sqlc
  2. Check to see if pathauto_state is set to 0 on a CONTENT_TYPE, where CONTENT_TYPE is replaced with the machine name of your content type.

    SELECT pathauto from pathauto_state p INNER JOIN node n ON p.entity_id = n.nid and n.type = 'CONTENT_TYPE';'
  3. Update the pathauto_state to 1;
    UPDATE pathauto_state p, node n SET pathauto = 1 WHERE p.entity_id = n.nid and n.type = 'CONTENT_TYPE';
  4. You can then update the nodes by navigating to /admin/content, filtering by content type and clicking on Update URL alias from the action drop down.

Cause

There is a bug in the latest version of Pathauto (Pathauto 7.x-1.3); How does Pathauto determine if the Automatic URL alias' checkbox should be checked or not? which explains;

  1. If the node is a new node, it defaults to having an automatic alias.
  2. If the node is not a new node:
    1. If the node does not currently have an alias, it assumes that the node was manually un-aliased, so it will default to not have an automatic alias.
    2. If the node's current alias matches the alias that Pathauto would generate based on the pattern, then it will default to checked.
    3. Otherwise, the checkbox will default to be unchecked.

Contact supportStill need assistance? Contact Acquia Support