Trailing slash is not preserved
See original GitHub issuevar urlJoin = require('url-join');
var joinedUrl = urlJoin('www.example.com', '/test/?hello=true');
console.log(joinedUrl);
Expected output:
'www.example.com/test/?hello=true'
Actual output:
'www.example.com/test?hello=true'
This causes issues for SEO where having 2 different URLs leads to fragmentation in search results.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:2
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Should You Have a Trailing Slash at the End of URLs? - Ahrefs
A trailing slash is a forward slash (“/”) placed at the end of a URL such as domain.com/ or domain.com/page/. But should you...
Read more >Trailing slash in links not preserved · Issue #94 - GitHub
If an erroneous server blunders around redirects (eg. nginx) and sends the client off to a bad location, there can even be a...
Read more >Trailing Slashes and SEO - Best Practice Guide | Safari Digital
Trailing slashes were a method of indicating that the current web destination was a folder rather than a file. It specified that it...
Read more >RESTful URI trailing slash or no trailing slash - Stack Overflow
The two positions are: The trailing slash indicates a resource and not having does not. The other argument is that the trailing slash...
Read more >[Python-Dev] pathlib handling of trailing slash (Issue #21039)
> A pathname that contains at least one non-slash character and that ends with one or more trailing slashes shall be resolved as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This problem still occurs and requires us to do workarounds.
I think situation is easier.
'/test/?hello=true'
contains/
before?
, so it should be preserved as whole fragment. It’s logical, expected behavior.