In this video, we'll take a look at the Pathauto module and configuring URL alias patterns.

You can find Pathauto at drupal.org/project/pathauto, and it requires the Token module which you can find at drupal.org/project/token

Install

Once you have them installed, we will enable the Pathauto and Token modules.

Enable

  • Pathauto
  • Token

Configure Patterns

Pathauto allows you to create various patterns to be used as URL aliases.

  • Configure these patterns at "Configuration => Search and metadata => URL aliases => Patterns" (admin/config/search/path/patterns)

The default path pattern for all content is "content/[node:title]". This means that an article titled "Awesome Article" would be at example.com/content/awesome-article. And a basic page titled "Awesome Page" would be at example.com/content/awesome-page.

Custom patterns per-content type

We can set different patterns for each content type on this page. So, if you're using the Article content type strictly for blog posts, you might want your URL to be something like "blog/2012/11/awesome-blog-entry". We can achieve this by using the following pattern for all Article paths:

  • "blog/[node:created:custom:Y]/[node:created:custom:m]/[node:title]"

If you're not familiar with using tokens, checkout the "Replacement Patterns" to see what tokens are available. There isn't a default token to get just the year or month, so I used "[node:created:custom:?]", which lets you use a custom format. (You can find the available parameters on the PHP documentation page linked in the description.)

To demonstrate that each content type can have its own URL pattern, I'll set the Basic page path to the following pattern:

  • page/[node:title]

Custom patterns for taxonomy terms and users

You can also set URL patterns for taxonomy terms and user account pages.