I had a client contact me today saying that path aliases were not working for new nodes on their Drupal 6 website. Looking at the site admin panel didn’t give me any clues, so I pulled out Navicat and had a look at the database directly.

For Pathauto the relevant table is called url_alias. Looking at the structure of the records, and putting a few test entries in there directly, soon gave me the clue I needed. The aliases that were working either had a language setting of ‘en’ or null (which translates as ‘All Languages’). The aliases that didn’t work had a language setting of ‘en-US’ – which my client had set up, but wasn’t actually using.

If there are only one or two aliases in this state, a manual operation in Drupal Pathauto would have fixed it quickly enough – Pathauto shows the language used for each alias. In my case, however, there were over 500 aliases being ignored due to bad language (!). The quickest solution was to (1) backup the table in Navicat, and (2) run an update statement on the table.

update url_alias set language = "" where language = "en-US"

This updated all the incorrect entries instantly, and they all started working again. We never found out why the language was changed, but when a high-traffic client site is adversely affected we’ll always solve the problem first and ask the question ‘Why?’ later.

Note: I recommend that you don’t use the above¬† on a multilingual (i8n)¬† website, as otherwise you could completely mess up your url_aliases. But on an English-only website, you should be safe. Your mileage may vary!