Skip to content

Handle trailing slashes when matching redirects#610

Merged
duncanmcclean merged 1 commit into
7.xfrom
redirect-trailing-slashes
Jun 19, 2026
Merged

Handle trailing slashes when matching redirects#610
duncanmcclean merged 1 commit into
7.xfrom
redirect-trailing-slashes

Conversation

@duncanmcclean

Copy link
Copy Markdown
Member

This pull request fixes an issue where a redirect rule for /foo would not be triggered when visiting the same URL with a trailing slash (/foo/).

This was happening because HandleRedirects looked up the incoming request path against stored redirect sources verbatim, so a request to /foo/ (which keeps its trailing slash) never matched a rule stored as /foo.

This PR fixes it by matching the request path against both its trailing-slash and non-trailing-slash variants, so visiting /foo/ finds a /foo rule and vice-versa. The root path (/) is left untouched.

Fixes #609

@duncanmcclean duncanmcclean merged commit 90948e3 into 7.x Jun 19, 2026
17 checks passed
@duncanmcclean duncanmcclean deleted the redirect-trailing-slashes branch June 19, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle trailing slashes by default

1 participant