Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Link to "/" with basename adds extra trailing slash causing SEO issues #8709

Closed
cornedor opened this issue Mar 8, 2022 · 4 comments
Closed
Labels

Comments

@cornedor
Copy link

cornedor commented Mar 8, 2022

What version of React Router are you using?

6

Steps to Reproduce

https://stackblitz.com/edit/github-aw7opq-k9k4xc?file=src%2Fmain.tsx

Use a basename in the router (for example /foo), there is no way to link to the basename without a trailing slash.

Expected Behavior

There is an option to link to the basename without a trailing slash.

Actual Behavior

Our project has a canonical URL ending without a trailing slash, this causes unnecessary redirects. There is currently no way to redirect to a basename without a trailing slash

This issue is related to #6226, but with an additional use case.

@cornedor cornedor added the bug label Mar 8, 2022
@BlazeIsClone
Copy link

yeah, I'm experiencing the same issue.

@strivelen
Copy link

I'm using a V5 version, I had the same problem, But I checked it, because there was a folder name with the same name as the route in my public folder. This problem no longer occurs after I change the folder name. hope this helps.

@github-actions
Copy link
Contributor

This issue has been automatically marked stale because we haven't received a response from the original author in a while 🙈. This automation helps keep the issue tracker clean from issues that are not actionable. Please reach out if you have more information for us or you think this issue shouldn't be closed! 🙂 If you don't do so within 7 days, this issue will be automatically closed.

@brophdawg11
Copy link
Contributor

I believe this was fixed in 6.4.0 via #8861. If you leave a trailing slash off the basename and then don't include one in your path you should be able to route to /foo

https://stackblitz.com/edit/github-aw7opq-vugywt?file=src%2FApp.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants