Localized Paths reachable from other languages when using differentDomains
See original GitHub issueVersion
Reproduction link
Steps to reproduce
- Set ‘differentDomains’ to true in i18n config.
- Specify ‘domain’ for each item in locales
- Add page-translations to ‘pages’
// nuxt.config.js
{
i18n: {
differentDomains: true,
locales: [
{
code: 'de',
domain: 'de.website.com'
},
{
code: 'en',
domain: 'en.website.com'
}
],
parsePages: false,
pages: {
login:{
de:'/anmelden',
en:'/login',
},
}
What is expected ?
de subdomain http://de.website.com/anmelden -> 200 http://de.website.com/login -> 404
en subdomain http://en.website.com/login -> 200 http://en.website.com/anmelden -> 404
What is actually happening?
de subdomain http://de.website.com/anmelden -> 200 http://de.website.com/login -> 200 // should be 404
en subdomain http://en.website.com/login -> 200 http://en.website.com/anmelden -> 200 // should be 404
Additional comments?
It is working as expected when not using custom domains:
de subdomain http://website.com/de/anmelden -> 200 http://website.com/de/login -> 404 // works
en subdomain http://website.com/en/login -> 200 http://website.com/en/anmelden -> 404 // works
<div align="right">This bug report is available on Nuxt community (#c281)</div>Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
Localizing URLs for new language sites - Search Laboratory US
We examine why URL structures matter for SEO and how to incorporate special characters that you may find in different languages.
Read more >How To Manage URLs On A Multi-Country ... - Marcello Brivio
So we moved everything under a “.com” domain, using subfolders for managing the different countries (and languages).
Read more >i18n should not assume 1-1 matching between translated ...
Hi, I'm not too sure I understand. You have two blogs: Chinese and English, and they are generated using Docusaurus i18n, with English...
Read more >Localization based on different domains - Laracasts
I'm a complete begginer in Laravel :) I want to have localization based on different domains with "mcamara/laravel-localization" package.
Read more >multiple languages same pages shall I change the page URL ...
Not many users actually look at the URL path and there are usually other areas in which translations and localization can be improved...
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
One workaroud I can think of is to create a global middleware that checks the current path matches the locale, and if not, redirects to the correct one:
Thanks for the quick response @Kapcash . I came up with a similar solution but was manually checking the routes against the router. I didn’t know about
app.localePath
🙌 .Can confirm that above workaround works.