Back to top

Setting Up Automatic URL Generation in Drupal 10

The standard Drupal URL looks like /node/123 and it is neither good-looking nor SEO-friendly. Google, as well as other search engines, always overlook such URLs, as web page crawlers can’t decipher the content of the node.

Adding a meaningful URL alias to each node manually might get challenging and time-consuming, especially on large websites. Does Drupal have a solution for generating user-friendly and SEO-friendly URLs automatically? Sure it does! In today’s blog post, the team at Drupfan explores why clear URLs matter and how to set up automatic URL aliases generation in Drupal 10.

Why do URLs Matter?

URL (Uniform Resource Locator) is much more than a subsequence of symbols that allocate the web page on the net. It is the introduction of a website to the users and search engines that forms the impression regarding our platform. Let’s see why optimized URLs are crucial for your website.

  • Enhanced Search Engine Optimization and Indexing

As we’ve already mentioned, an optimized alias is highly preferred by Google and other search engines. Hierarchical and descriptive URLs not only make it easier for crawl bots to navigate through your website but also guarantee a higher position in SERP (search engine results page).

auto url
  • Better Website Navigation with Breadcrumbs

A hierarchical URL that represents the site’s structure is the proven way to enhance a website's navigation, as well as make it more intuitive. Use breadcrumbs. Breadcrumbs is a special type of navigation structure that helps users understand their current location on a website, as well as their journey through the site to the current page.

  • Higher Retention Rates via Enhanced User Experience

When users can easily navigate through the website and effortlessly find what they need, their loyalty grows. When a user is satisfied with his experience on the site, he comes back. As a result, the retention rate improves, and conversions skyrocket.

Learn more about Drupal technical search engine optimization in our recent blog post.

Key Points of SEO-proofed URLs

Here, the Drupfan web specialists outline the key characteristics of a good and SEO-friendly URL:

  • URL is descriptive: an alias should give users and search engines a general idea of the web page content. All words should be readable. Please avoid IDs. You can also omit articles.
  • Words in URL are separated with punctuation: to separate words in aliases, use a dash symbol. F.e. /automatic-url-generation-in-drupal
  • URL contains keywords: the best solution for alias words’ choice is to simply add keywords that are relevant to the web page content.
  • URL is short: keep the URLs short while preserving their descriptiveness. The maximum recommended length for a URL is 75 characters.

How to Set Up Automatic URL Generation in Drupal 10?

The automatic generation of URLs in Drupal is not a challenge, thanks to the Drupal community! On, you can find modules aimed at this task. Here, the Drupfan Drupal team explores the best solution for setting up URL aliases automatically — the Pathauto module.

Drupal Pathauto module

Pathauto is a contributed Drupal module that automatically generates URL aliases for any content (nodes, users, taxonomy terms, media, etc.). The URL generation via Pathauto is not random: this module allows you to configure the desired pattern or structure. Pathauto not only assists in the generation of aliases for the new content but also can regenerate URLs for the existing web pages.

A Short Guide to Drupal Pathauto module

Let’s install and configure the Pathauto module on the Drupal 10 website together.

  1. Installing Pathauto

To install the Pathauto module, simply paste this command to the console:

composer require drupal/pathauto

Then, proceed to the ‘Extend’ tab in the admin menu on your website, search for Pathauto, tick the check box, and install it.

  1. Configuring Pathauto

Now you need to create certain URL patterns which the Pathauto will be using for automatic aliases generation. Go to the ‘Configuration → Search and metadata → URL aliases’ in the admin menu. Proceed to the ‘Patterns’ tab and click on ‘+ Add Pathauto pattern’. Then:

  • Select a Pattern type — entities, you are creating a pattern for. In our case, this is Content Entity.
  • Create a pattern itself. F.e. add the unchanging part of the URL and then add a pattern for specification. As we are creating a path pattern for the Recipe content type, we add the unchanging part ‘recipe/’ and then instruct Pathauto to add the title token by entering ‘[node:title]’. So, our URL pattern is ‘recipe/[node:title]’. If you are not familiar with tokens, you are more than welcome to install the Token Drupal module that provides placeholders for URL patterns. You can access a list of available tokens by clicking on ‘Browse available tokens’.
  • Choose content types you are creating a pattern for. This is a multiple select but in our case, we restrict the pattern to Recipe content type only.
  • Create a clear and descriptive label for your pattern.
  • Don’t forget to put a tick on the checkbox near ‘Enabled’ and save the changes.

Congrats! Now you know how to create alias patterns through the Pathauto module on Drupal 10 websites. However, its configuration should be pretty similar for older Drupal versions as well.

  1. Regenerating URLs for existing content

The instructions above are only working for the new content. But how to regenerate URL aliases for the content that already exists?


Go to the ‘Configuration → Search and metadata → URL aliases’ in the admin menu and choose the ‘Bulk generate’ tab. Just choose the entity type for which you’d like to regenerate the aliases and select one of the options below based on your needs:


  • Generate a URL alias for un-aliased paths only
  • Update the URL alias for paths having an old URL alias
  • Regenerate URL aliases for all paths

That’s it. Hope this brief tutorial will assist you with automatic URL generation on Drupal websites.

Final Thoughts

Automatic alias generation is an effortless and error-free process thanks to the Pathauto Drupal module. Optimized URLs not only attract more visitors but also make your website rank higher in search results. If you require any assistance with URL configuration on the Drupal website rely on Drupfan, your reliable Drupal development partner.