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.
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.
- Log into the database using the below command, within your site's directory within the docroot or with your specific drush alias
Check to see if
pathauto_stateis 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';'
- Update the
UPDATE pathauto_state p, node n SET pathauto = 1 WHERE p.entity_id = n.nid and n.type = 'CONTENT_TYPE';
- 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.
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;
- If the node is a new node, it defaults to having an automatic alias.
- If the node is not a new node:
- 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.
- If the node's current alias matches the alias that Pathauto would generate based on the pattern, then it will default to checked.
- Otherwise, the checkbox will default to be unchecked.