Ignore i18n cookie if directly opened an URL with a different locale
Hi! I have an Nuxt 2 project with i18n enabled and 4 locales configured. I am running into an SEO issue, where deeplink for page specific to given locale e.g.
/de-DE/mypage
will throw 404 when user has previously browsed using another locale. It seems, Nuxt always reads the cookie and redirects to previous locale. I tried many setup changes in nuxt.config they do not seem to have any effect even skipSettingLocaleOnNavigate : true
as well.
So, question is - is it possible to force locale change when user opens a link from another source that has different locale then the one browsed/saved in i18n_redirected cookie?3 Replies
Hi @wszymanski. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I'm sorry, but the knowledge sources provided do not contain explicit information about configuring Nuxt 2 with @nuxtjs/i18n to ignore the i18n cookie when a user directly opens a URL with a different locale. The sources discuss related issues such as browser language detection, cookie usage, and locale strategies, but do not address this specific scenario or provide a configuration that would force the locale to match the URL over the cookie in Nuxt 2.
If you are using Nuxt 3, there are some discussions about locale detection and cookie handling, but these do not directly translate to Nuxt 2 or your exact use case. Therefore, I cannot provide a confident answer or code solution based on the current knowledge sources.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@769975551112118312> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
thanks, perhaps a member of community will answer this?