A site has many path aliases generated using the Pathauto module, or from the user interface.

I want to get all the aliases the site has. how can I achieve this?

  • 1
    I believe all aliases are kept in the url_alias table, so you could query the table.
    – No Sssweat
    May 20, 2016 at 6:37
  • In D8 database didn't found such table May 20, 2016 at 6:38

1 Answer 1


I got a fresh installed d8.1 and a fresh pathauto 8.1.x-dev. I got the url_alias table in my database by installing the module.

the table schema is [pid | source | alias | langcode]

I guess what you want to do is something like this:

$query = db_select('url_alias', 'ua')
  ->fields('ua', array('alias'))

that should give you the result you want.

  • url_alias table is created by pathauto module. So, from this table it couldn't be possible to get the path aliases created from user interfaces. May 20, 2016 at 7:36
  • yes and no. The url_alias table should exists by default cause the path module is in drupal core now.
    – DiDebru
    May 20, 2016 at 8:17
  • I'm using Drupal 8.0.6 and i don't have this table by default. May 20, 2016 at 8:19
  • But you can give aliases in the UI. Maybe you could get a dump of your site and setup adminer.org/en local, which contains a full text search.
    – DiDebru
    May 20, 2016 at 8:32
  • url_alias is added by core and is in 8.0.6.
    – Shawn Conn
    May 21, 2016 at 1:13

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.