-
-
Notifications
You must be signed in to change notification settings - Fork 490
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
fix: exclude unprefixed routes for strategy prefix
#2538
fix: exclude unprefixed routes for strategy prefix
#2538
Conversation
as your mention,redirects to the default language route. this befavior is from nuxt-i18n v7. |
Hello, Does it handle correct redirection from Thanks! |
Thanks feedback! @BobbieGoede |
You need to set
As described above this seems to already work with the correct configuration.
After giving it more thought, I suppose it makes sense to redirect to a localized catch all route rather than responding with a plain 404 response. Hmm 🤔 not entirely sure what would be the best approach. I believe this PR should at least resolve #2131. |
I'll check but just make sure this won't create a regression later.
Returning 404 doesn't make sense, it's like returning 404 error code on the root path You might be surprised but the old version had this problem and a lot of pages were duplicated in search engines. The reason behind this is that i18n module for Nuxt didn't handle correctly SEO. So redirecting to the correct page according to the language header or Only in 2020 SEO feature was integrated correctly, I'm not sure why my contribution silently lost but there are PRs with the reasoning and explanation behind it so I'd expect at least this should work like the previous version which logic was fixed. Thanks! |
I tested this, and the unprefixed routes are still available. |
@rudolfbyker |
I double checked, and I definitely do not have a catch-all route. See my updated example with explanation at #2524 (comment) . Thanks for your time. |
This PR is good. It removes the unprefixed routes as intended. #2524 seems to be a separate issue. |
* fix: exclude unprefixed routes for strategy `prefix` * test: add redirect test for strategy `prefix`
🔗 Linked issue
Accept-Language
header #2524prefix
, unprefixed routes are accessible #2131❓ Type of change
📚 Description
@kazupon
What is the intended behavior for projects with
redirectOn: 'root'
when accessing an unprefixed (non existant in this case after this change) route like/about
, should it return a 404? Right now this still redirects to the default language route, relevant issue: #2524.Let me know if there are specific cases are missing tests for this change!
📝 Checklist