Pathauto

Pathauto builds URL aliases from patterns such as /blog/[node:title], so items of one type get consistent addresses without anyone typing them.

Learn DrupalDrupal glossary

Pathauto is a contributed Drupal module that generates URL aliases automatically. You define patterns made of fixed text and tokens, and Pathauto builds an alias from them whenever an item is saved. It covers nodes, taxonomy terms and users. It builds on the core Path module and needs the Token module.

How Pathauto works in Drupal 11

Patterns are the core of the module. The Patterns page at /admin/config/search/path/patterns creates, edits and reorders them. According to the module's help text, an alias comes from the first pattern that applies. Pathauto adds a computed "URL alias" field to every enabled entity type and replaces the path widget with its own.

The Settings page at /admin/config/search/path/settings controls how aliases are built:

  • Update action: do nothing and leave the old alias, create a new alias and keep the old one working, or create a new alias and delete the old one. The install configuration of 8.x-1.15 sets the third option.
  • Separator: the character that replaces spaces and punctuation; the install configuration uses a hyphen.
  • Maximum alias length and maximum component length: the form calls 100 the recommended value for both.
  • Reduce strings to letters and numbers: keeps only characters from the ASCII-96 set.
  • Character case: converts token values to lowercase. Fixed text in the pattern is not affected.

Two more pages do bulk work. /admin/config/search/path/update_bulk generates aliases for items that have none, which suits a site that installs Pathauto after content exists. /admin/config/search/path/delete_bulk removes aliases that Pathauto created.

On the edit form, the widget shows a "Generate automatic URL alias" checkbox. While it is checked, the manual alias field is disabled. If no pattern applies to the item, the checkbox does not appear.

Example

The module's own tests use the pattern /content/[node:title] for content items. A node titled "Sample article" gets the alias /content/sample-article. Pathauto lowercases the title and replaces the space with the separator. The part in square brackets is a token.

Common mistakes

  • Expecting a changed pattern to rewrite old aliases. Run Bulk generate and pick an option that updates existing aliases. The Update and Regenerate options appear only when the update setting does not ignore existing aliases.
  • Deleting the old alias without a redirect. The third update action removes the old address. Install the Redirect module, which the Pathauto project recommends, so old links keep working.
  • Setting a maximum length above the database column. The help text says the limit should fit the alias column and leave room for suffixes.
  • Looking for the checkbox on an item without a pattern. No pattern means no automatic alias.

For marketing and content teams

A pattern decides the alias of every new item of a type, so agree on patterns before you publish or migrate content. After that, editors can leave the checkbox on and concentrate on a good title. Because the update action may change the alias when a title changes, ask your developer which action the site uses before you edit titles on published pages.

With DXPR

The DXPR CMS project page says its clean, SEO-friendly URLs are generated with Pathauto. See DXPR CMS.

Sources

Questions about Pathauto

Yes, when an item set to automatic aliasing is saved and the update action is not Do nothing. A changed pattern does not touch other items until they are saved or you run Bulk generate with an update option. The Pathauto help says bulk regeneration skips items whose alias was set by hand.

Uncheck Generate automatic URL alias on the edit form. The manual alias field is disabled while the box is checked, and it becomes editable when you uncheck it.

That depends on the update action: leave the old alias working, or delete it. The Redirect module has a setting to create a redirect automatically when an alias changes, so links to the old address keep working.

No. It is a contributed module that needs the core Path module and the Token module. The 8.x-1.15 release lists support for Drupal 10.2 and Drupal 11.

Related terms

All Drupal terms from A to Z