Skip to content

Pathauto Configuration

Santam Chakraborty edited this page Jul 21, 2023 · 2 revisions

Pathauto is a contributed module which allows custom URLs to be created for content. By default Drupal assigns paths as [site-name]/node/[autoincrement number] where autoincrement number is the node id in the database. This is of course a security risk as it allows something called node id enumeration. To prevent this we use the Pathauto module to generate automatic patterns for the paths on the site.

To setup this configuration go to Configuration > URL aliases and navigate to the Patterns tab. In the screenshot below we can see that we have setup the pattern of the path to match the node title. Similiar configuration is possible for other parts of the site like the Media, Taxonomy Terms and User

image

After doing this do not forget to generate the URLs by going to the Bulk generate page create the URL alias for un-aliased paths. The word un-aliased means that path is not set manually. If set manually it would be for a good reason and probably not a good idea to tinker with it.

image

Note the List tab shows all the nodes which have an alias. This page can also be used to add alias to an entity.

image

⚠️ It is still technically possible to navigate to the page by typing the node number. In order to restrict this behaviour also the Redirect Module is required.

Clone this wiki locally