I am using Pathauto. When I deleted a piece of content, I was surprised to find that its url alias was still mapped to the now-nonexistent content (node/xxx).

How can I have this alias and System name mapping removed automatically when the node is deleted?

Edit: I want to keep the Update action set to "Do nothing. Leave the old alias intact.", because I don't want paths to change when nodes are adjusted. However, it doesn't make sense to keep a path around if the node was deleted completely. Can I have both options somehow?

3 Answers 3


You can use hook_node_delete:

function hook_node_delete($node){
    // Delete alias.
    $path = path_load(
      array('source' => 'node/'.$node->nid)


You can update aliases here, or on the node


or bulk update a whole bunch here


based on an alias pattern change set here


I imagine the reason it "Seems" like an alias didn't delete is because it have forwarding to another alias in a sort of chain. Drupal does clean up alaises on content delete, ou can do a simple test and see it happen. But if you have alaises chained it only seems to delete the final alais and leave the others. I think if you update you "update actions" you can minimize the number of extra alaises created.

Go here and find the section called "Update action" /admin/config/search/path/settings

You have three choices of what to do when an alais changes

  • Do nothing. Leave the old alias intact.
  • Create a new alias. Leave the existing alias functioning.
  • Create a new alias. Delete the old alias.

Also based on there advice "Considering installing the Redirect module to get redirects when your aliases change."

I hope this helps ans isn't off base but I faced similar issue on a site with 500k items and the clean up was a serious issue. Best of luck!

  • Lots of info in this answer, but I've looked through all those options. Still don't see anything that answers the question. Commented Feb 3, 2015 at 0:27

You can update the path aliases here in the Admin > Config menu: admin/config/search/path/update_bulk

  • 1
    This neither removes the mapping nor is automatic... Commented Jan 27, 2015 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.