Problem/Motivation

When a URL alias is saved, Redirect deletes every redirect in the alias's language that starts from that path: always in pathAliasInsert(), and in pathAliasUpdate() when "Automatically create redirects" is on (#3534916: deletion of redirects for a path alias's new alias only happens for update if redirect creation for alias changes is enabled would make that always too). That keeps the alias working, since an alias wins over a redirect from the same path, but the redirect is gone without a message. An editor who picks an alias that matches a redirect made for a campaign or a printed URL deletes it, and nobody notices until that URL stops going where it should.

7.x-1.x disabled these redirects instead, for this reason (#1796596: Fix and prevent circular redirects). Redirects have had an enabled field since 8.x-1.12, so 8.x-1.x can do the same.

Steps to reproduce

  1. Add a redirect from company/staff to /team.
  2. Give a page the alias /company/staff.
  3. The redirect is no longer in the redirect list.

Proposed resolution

In pathAliasInsert() and pathAliasUpdate(), disable the matching redirects instead of deleting them. This needs #3642388: Changing a URL alias fails when a disabled redirect starts from the old alias first: without it, changing an alias that a disabled redirect starts from fails.

Remaining tasks

  • Decide whether sites can keep deleting, so disabled redirects don't pile up.
  • Decide whether editors see a message naming the redirect that was disabled.
  • Merge request with tests.

User interface changes

Redirects an alias takes over stay in the redirect list, disabled.

AI disclosure

Generated with the help of an LLM. I found this while working on code that moves URL aliases. Claude Code checked Redirect's code and history, confirmed the behavior on a local site and drafted this issue; I reviewed it.

Comments

dave reid created an issue.