I'm building a site in Drupal 8 that will have complex content best viewed using views. The basic pages should use nice and clean URL aliases.

Is there a way to stop the visitor from accidentally using /node/x in the URL and only allow accessing the views and pages that have aliases and organised in the website menus?


Yes, in Drupal 7 this functionality was covered under the Global Redirect module. It has since been merged in the Drupal 8 version of Redirect.

Under the Redirect settings (/admin/config/search/redirect/settings), the Global Redirect section contains options to enable alias, non-clean, & canonical redirecting. This will enable you to redirect any requests from /index.php?q=node/X or /node/X to /my-canonical-content-alias.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.