Getting a shorter URL (Redirects and Aliases)

There are two very important types of URL features in Drupal: (1) URL redirects and (2) URL aliases. URL redirects can be used for a variety of purposes, such as redirecting an old URL to a new location in the event content is moved or deleted. URL aliases exist on every page, it's the part of the URL which specifies the document location. For example, the URL /music/55/page has the alias 55/page. By default, aliases are automatically generated based on the first published title of the page and the node number. This however can be changed and we will discuss this below to create cleaner URLs for important, static pages. 

URL Aliases

Drupal has a feature called "URL Alias" that allows you to provide a more understandable name to the content. The Pathauto module automatically generates URL/path aliases for various kinds of content (nodes, taxonomy terms, users) without requiring the user to manually specify the path alias. This allows you to have URL aliases like /category/my-node-title instead of /node/123. The aliases are based upon a "pattern" system that uses tokens that the administrator can change.

In the event that the generated URL alias isn't sufficient, editors can change the URL alias by:

  • Editing the piece of content in question.
  • Clicking URL Path Settings in the left side menu.
  • Unchecking "automatically generate URL alias"
  • Changing the value of the URL alias to a more readable string.

It is important to note: the slug should be as unique as possible. Attempt not to use words or terms which are existing site titles as Drupal has issues with duplication. For example, /conference is a website so the single term "conference" cannot be a page alias inside another site.

generate alias checkbox example

URL Redirects

Site content editors are responsible for managing their URL paths under their sites. 

There are some best practices with URL redirects: 

  • URL Redirects should be used to preserve old URLs that are being grandfathered. That is, redirecting an old URL to a new piece of content elsewhere. The old URL should be changed to the new URL going forward. 
  • URL Redirects should not be used in place of URL aliases. If possible, rename URL aliases to better present a readable URL. 
  • URL Redirects should not be used to publicize content. 
  • URL Redirects should be used internally only if possible. URL Redirects outside of the same site can be flagged as spam. 

There are some drawbacks with URL redirects that need to be considered: 

  • Slows Performance - URL redirects create an extra hop and extra database lookups. This can cause increased load times and mask the true endpoints.
  • Search Engines don't mark redirects as internal and won't index them appropriately. This means no rank points are given to URL redirects which can hurt SEO. 
  • Redirects can create looping or chaining issues. 
  • Redirects to external resources may get sites flagged as spam. Sites with too many external redirects which are used frequently can become marked as spam by search engines.

If you want a clean URL for a page within your site, consider exploring a clean URL Alias. Details can be found below. 

If you want to delete an old piece of content without breaking external links, you can use a URL redirect to accomplish this. However, changing or requesting the external links be updated is vital as the URL redirects may eventually be lost. Use the new URL in any place the old URL can be changed or updated going forward.

Learn more about how to create a URL redirect.


I heard it was possible to get short URLs from the main website, is this true?

Unfortunately, URL redirects from the homesite are reserved for special cases. The drawbacks of URL redirects are amplified when used at the top level which can create more complicated, site-wide issues. As of November 2020, homesite URL redirects have been limited to sites which have had their URL changed (for instance, /hr still goes to /humanresources as the new URL is grandfathered in). Homesite URL redirects cannot be used for vanity purposes as the technical debt associated with these types of redirects outweighs the benefits.