Repository navigation
Redirect source URLs ending in a slash should also match slashless URL #16956
workers-devprod
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Moved from #1334. Originally opened by Hexstream on 2022-06-22.
What version of
Wranglerare you using?2.0.15
What operating system are you using?
Linux
Describe the Bug
It is widespread standard practice to redirect "directory" URLs not ending in a slash to the equivalent (canonical) URL ending in a slash, provided the directory index exists, and Cloudflare Pages already does so.
For instance,
https://www.example.com/foowould typically redirect tohttps://www.example.com/foo/.As such, I strongly believe that a redirect like
/foo/ /bar/ 301,as well as redirecting
/foo/to/bar/,should also redirect
/footo/bar/.Another argument is that, let's say you have a directory index at
/foo/(and/foo), and later you decide to delete it and replace it with a redirect with source URL/foo/, then the/fooURL (redirect to canonical) will not work anymore, which doesn't seem logical. And I think/foowould still work if you added the redirect but (deliberately or accidentally) did not delete the file, which is a bit weird.For now, the workaround is to manually create that second redirect every time, but this seems gratuitously painful.
(Note that a redirect of
/foo /bar/ 301should NOT also redirect/foo/, because/foo.txt /bar.txt 301clearly should not redirect/foo.txt/.)nprogers commented on 2022-09-07:
We did reproduce your issue, and it does make sense to fix. We've added to our backlog. Thanks!☺️
Hexstream commented on 2022-09-07:
Awesome!! Thank you!!
Hexstream commented on 2024-04-07:
Now that Cloudflare Pages supports
wrangler.toml, it would be easier to make the new behavior optional, retaining the old behavior by default for backwards compatibility.How about
also-redirect-slashless = true? The default would bealso-redirect-slashless = false.All reactions