Problem/Motivation

Starting in Drupal 11, if more than one alias exists for a node and a user requests one of the secondary aliases, the AliasManager no longer sets the response using the canonical alias. Instead, it simply uses whatever URL the user requested if it exists as an alias. This impacts the Redirect module's ability to "Enforce clean and canonical URLs" which, in turn, no longer causes an automatic redirect to the canonical when a secondary alias is requested. This is different from the behavior of previous versions of Drupal (8/9/10).

Steps to reproduce

  1. Ensure the redirect module is installed and the "Enforce clean and canonical URLs" setting is on (default)
  2. Create a new node and give it an alias such as /canonical
  3. Go to the administer aliases page (/admin/config/search/path) and add a new alias for the node you just created such as /alias
  4. Visit the /alias URL in a browser. You will not be redirected to /canonical as you would have been in D8/9/10

Proposed resolution

Restore AliasManager's ability to lookup and use the canonical URL for a node instead of relying on whatever the user has entered.

Issue fork drupal-3585268

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mdziedzic created an issue. See original summary.

cilefen’s picture

It would be ideal to know which commit to AliasManager changed the behavior. It could have been an important bug fix, for example.

mdziedzic’s picture

Status: Active » Needs review
quietone’s picture

Version: 11.x-dev » main

Hi, Issues for Drupal core should be targeted to the 'main' branch, our primary development branch. Changes are made on the main branch first, and are then back ported as needed according to the Core change policies. The version the problem was discovered on should be stated in the issue summary Problem/Motivation section. Thanks.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Bug Smash Initiative, +Needs tests

Thank you for reporting!

As mentioned the MR will need to be pointed to main first and then potentially backported. Also as a bug will need a test case showing the issue please

Thanks.

mdziedzic changed the visibility of the branch 3585268-aliasmanager-no-longer to hidden.