How to Create Vanity URLs In Drupal

In this comprehensive guide, I will walk you through the process of creating vanity URLs in Drupal 8, along with the use of a link shortener for added convenience.

Vanity URLs are customized, easy-to-remember, and user-friendly web addresses that improve the overall user experience and brand recognition. 

Get Pathauto Module

Drupal 8 offers a powerful module, Pathauto, that allows you to create vanity URLs effortlessly. Pathauto works by automatically generating URL aliases for various types of content, such as nodes, taxonomy terms, and users, based on configurable patterns.

pathauto module

Visit the Pathauto project page ( and download the latest version compatible with your Drupal 8 installation.

  1. Extract the downloaded file and upload the 'pathauto' folder to your 'modules' directory on your server. 
  2. Log in to your Drupal 8 admin dashboard and navigate to Extend (or 'admin/modules'). 
  3. Locate the Pathauto module, check the box next to it, and click 'Install.'

Configuring Pathauto

Once the Pathauto module is installed, you can configure it to create vanity URLs for your website:

  1. Navigate to the Configuration tab in your Drupal 8 admin dashboard. 
  2. Under the 'Search and Metadata' section, click on 'URL aliases.' 
  3. Click on the 'Patterns' tab, where you can create URL alias patterns for different content types, taxonomy terms, and users. 
  4. Define your patterns using tokens, which represent specific data fields. For example, to create a pattern for blog posts, use '[node:title]' as the token, and the URL will be generated based on the title of the post. 
  5. Save your settings by clicking 'Save configuration.'

Creating Custom URL Aliases

vanity url in drupal

If you want to create a custom URL alias for specific content:

  1. Navigate to the content editing page for the desired node, taxonomy term, or user. 
  2. Scroll down to the 'URL alias' section.
  3. Uncheck the 'Generate automatic URL alias' box, then enter your custom URL alias in the provided field.
  4. Save your changes.

Using a Link Shortener with Drupal

In some cases, you might want to use a link shortener to make your vanity URLs even more compact and easy to share.

You can integrate link shortening services like Bitly, Pretty Links, or TinyURL with your Drupal site. Most of these services offer a Drupal module or an API that you can use to automatically shorten your URLs.

Leave a Comment

Your email address will not be published. Required fields are marked *