I have a content type where I want to delete all of its URL aliases in bulk. Currently the pathauto url alias page only has the option to delete all content url aliases regardless of what type it is.

How can you delete url aliases in bulk matching only a specific content type?

Also would it be okay to delete the url_aliases via phpmyadmin? I'm not sure if the url_aliases table is linked to something else.

  • is there a particular reason you can't bulk delete all content aliases and bulk regenerate them ? If there is, see drupal.org/node/144904 – Dom Day Jun 29 '13 at 3:20
  • because I have some manually entered url aliases associated with some of the content. – Patoshi パトシ Jun 29 '13 at 17:32

I'd go with Views Bulk Operations.

  • set the pathauto path for the content type to the default you want, but don't bulk update
  • create simple view for the content type you're interested in
  • add the field Bulk Opertations: Content
  • Under Bulk Operations Settings check Enable "Select all items on all pages"
  • select Update Node Alias
  • add filters as required

navigate to the view page, select all, uncheck any special cases, and give it a whirl

but maybe backup first

  • 1
    This works! NOTE: do not check the box "Enqueue the operation instead of executing it directly" when configuring the Bulk Opertations options – Duncanmoo Nov 20 '13 at 9:31
  • This will update the node aliases but not deleting url aliases... – Justme Dec 12 '16 at 23:54

I'd do it as an SQL query. Run as a SELECT first, to verify that all is well:

 SELECT alias FROM node n JOIN url_alias u ON CONCAT('node/', n.nid) =
 u.source WHERE n.type='my_type'

then edit it to make it a DELETE:

 DELETE u  FROM node n JOIN url_alias u ON CONCAT('node/', n.nid) =
 u.source WHERE n.type='my_type'
  • just what i needed. fyi for those that dont know. run this via drush sqlq ' ' or phpmyadmin. thx. – Patoshi パトシ Jun 30 '13 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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