Allow Redirects with Trailing Slashes in Source Path

Created on 5 November 2024, 20 days ago

Problem/Motivation

The Redirect module currently disallows adding source redirects with trailing slashes (e.g., /example/). This limitation makes it challenging to manage frontend redirects where trailing slashes may need to be included. For headless or decoupled CMS setups, where Drupal acts purely as the content management backend and the frontend handles routing, the ability to add redirects with trailing slashes is necessary. This is a common use case for headless or backend-only CMS setups.
The current behavior in the Redirect module restricts users from creating source paths with trailing slashes, based on an earlier issue: " Don't allow adding source paths with trailing slashes, they won't ever work β†’ ". While this makes sense for sites where Drupal manages routing, it limits flexibility for backend-only setups and headless CMS configurations, where managing trailing slashes on source paths is essential for consistency .

Steps to reproduce

  1. /admin/config/search/redirect/add
  2. Add url with trailing slash in Pathfield eg (meetings/)
  3. Add redirect url To field eg (https://www.test.com)
  4. Click Save
  5. Saved redirect will be meetings https://www.test.com

Proposed resolution

Allow users to enter source paths with trailing slashes as valid redirects. This change would only affect configurations where Drupal is used as a backend or headless CMS, allowing developers the flexibility to manage paths in a way that matches frontend expectations.

✨ Feature request
Status

Active

Version

1.10

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jbiswas

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024