Configuring URL Aliases

URL aliases configuration can be managed by the administration user by navigating to Admin \ Configuration \ Search and Metadata \ URL aliases, This will navigate to the URL aliases admin page which contains multiple tabs to configure URL aliases. The taps that can be seen in the URL aliases page are the following:

  • List

  • Patterns

  • Settings

  • Bulk generate

  • Delete aliases

Creating Patterns for Specific Entities

To start creating patterns for some specific entities, navigate to the Patterns tab. This is where the URL aliases template is specified for each entity type, one entity type can have multiple URL alias patterns.

The page will show some predefined patterns, the table of patterns includes:

  • Label - This is the name defined by the user to identify the pattern.

  • Pattern - This is the pattern itself, it consists of keywords and tokens which will grab the needed data to be placed in the URL alias.

  • Pattern type - Will identify to which entity type the pattern belongs to.

  • Conditions - On which basis the pattern will be applied, the condition uses the machine name of the entity type.

A new URL pattern can be created by clicking on the Add Pathauto pattern button. The add Pathauto pattern will prompt the user to select the entity type wanted then it will show some other options related to the entity type selected.

The Path pattern field will contain the pattern needed, the pattern field can include fixed keywords which are mostly the entity types, and also some tokens that are used to retrieve the data needed to populate the URL alias.

The list of tokens can be seen by clicking on the Browse available tokens link.

When selecting some entities, a list of entity types will show up to select from.

Example (1) - Simple URL Alias:

For this example, we will choose the media pattern type, we want the URL alias to show the name of the media entity so the [media:name] token should be used since it will retrieve the name of the media entity, fixed keywords can be also used so we can modify it to be /media/[media:name]

when navigating to a media entity the URL will be domain.com/media/media-name

Example (2) - Automated Hierarchical URL Aliases:

This example will add the path pattern for a basic page content type, the content pattern type should be selected, for pages. The most common thing is to display the title of it in the URL so the [node:title] token should be used, in some cases, the page might be a child of another page so the system might not be able to retrieve it using a single token so another token can be added, [node:menu-link:parents:join-path] token can be used to retrieve the parent link title if found, this will be omitted if no parent link available, the final pattern will be [node:menu-link:parents:join-path]/[node:title]

Global Settings for Patterns

The settings tab is used to configure the overall global settings for URL aliases.

Enabled entity types will show where the URL alias is enabled, the user can also enable other entity types to have URL aliases or to configure a new pattern for them.

Some other options that can be configured are:

  • Separator - Which is the character used to separate words in titles, in Varbase it’s (-) by default.

  • Strings to Remove - Defines which keywords to omit when building a URL alias.

  • Update action - What will happen when creating a new URL alias or editing an existing URL alias.

When selecting the “Create a new alias. Delete the old alias.” option, the URL alias isn’t deleted, but gets added as a previous redirect to ensure that the old URL alias will still function.

  • Safe Tokens - Will have the list of tokens/words that are safe to use in an alias pattern and need no cleaning

  • Punctuation - Will contains some punctuation marks and the action to do when having them in a URL alias, by default they are removed but another option is to replace them with the separator defined beforehand, selecting the option “No action(do not replace)” might cause problems with some URLs.

Last updated