Redirection doesn't happen in redirect module when we save path alias of a node in Source.

Created on 23 May 2016, over 8 years ago
Updated 2 April 2024, 9 months ago

Hi,

As i installed Redirect module in Drupal 8 and here during adding redirect it accepts and save the data for all valid value.
But when I try to save the path alias of a node in source it saves successfully but redirection does not happen and for the same when I save node/{id} in source redirection happen properly.

Why path alias does not redirected in case of saving it in to the source?

If anyone have idea regarding to this please help me.

Wildcard is also not working.

🐛 Bug report
Status

Closed: works as designed

Version

1.0

Component

Miscellaneous

Created by

🇮🇳India rajeevkumar

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇧United Kingdom kewesley

    We were also running into this issue. The current warning shows the same message regardless of whether the existing path is a system path or a path alias and, in my opinion, I don't think the message is sufficiently clear that the redirect will not take effect if the source path is an existing path alias. It does make sense that the alias gets priority, but is very easy to forget or overlook.

    Often, the redirect is being added some time after the alias was originally created, sometimes not by the same person, and because the form still allows the redirect to be created, they assume it will work.

    I attach the patch we are using to detect path aliases and show a stronger warning, in case anyone else would also find it useful. I believe it requires at least Drupal 8.9 due to using \Drupal::service('path_alias.repository'). Unfortunately, it seems there is no way to query for an alias without also specifying the langcode to check, so there might be a bit more overhead on sites with several languages installed. This patch will also block the redirect from being created if it detects a path alias is being used as the source.

    If you do need to redirect from one node to another, you can use the system path as the redirect source, even without removing the alias (with or without the patch).

Production build 0.71.5 2024