Redirects/URL aliases not working as expected

Created on 12 May 2025, 2 days ago

Problem/Motivation

I’m not sure if this is a bug or a feature request. We expect to be able to track redirected URLs because the content is still being used. If you create two nodes: 1A and 2A, and you link 1A in 2A, then the usage for 1A will show it is used in 2A. If you run eu-r to recreate the usage, then you will see 1A is used in 2A. If you then change the alias for 1A to 1B, creating a redirect, then 1A still appears as used in 2A. There’s a link to 1A that takes you to 1B. However, if you run eu-r again because you updated your settings and now want to track media as well as content, then the 1A/1B usage disappears from 2A. This seems unexpected. The content is still being used and referenced, so the connection should remain.

Steps to reproduce

Drupal 10.4.6
entity_usage 2.0.0-beta24 (default settings)
drupal/redirect 1.11.0

Proposed resolution

Recreating the entity usage would not remove redirects/aliases from the usage tables.

💬 Support request
Status

Active

Component

User interface

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @hannakras
  • 🇪🇸Spain marcoscano Barcelona, Spain

    Do you have redirects enabled as souce/target in the settings page?
    As soon as you have a redirect in the middle it starts becoming one extra entity in the chain, so that needs to be tracked as a separate entity.

  • Yes, redirect and URL alias are enabled as both source and target. One thing I forgot to mention in my post (I'll update it) is that these links are not properly linked using Linkit or some other tool, they are hardcoded in the source in a/href tags. <a href="/title-1A">cool page</a> They work as expected and appear in usage, but if you recreate usage settings after switching the page to /title-1B, those hardcoded links to /title-1A disappear from the usage tab.

    Side note: Needing to have redirect enabled to track redirects isn't ideal UX for our authors. They see "- Restricted access -" "Redirect: redirect," which can be confusing. Admins already can see redirects from inside the node edit screen. It would be nice to be able to granularly exclude the actual redirect entity from appearing in the usage table but still be able to view the actual links that happen to be redirected. If you think this request has legs, I can open a separate ticket.

Production build 0.71.5 2024