Netlify redirects vs NextJS default language

Hiiiii, loving netlify for many reasons but redirects based on country or language are problematic.

We’re using NextJS with EN as our default locale and FR etc for some other languages.
Eg: ourdomain.com/foobar
and ourdomain.com/fr/foobar

That is all fine until we try to redirect people in France to the fr language site:

[[redirects]]
  from = "/*"
  to = "/fr/:splat"
  conditions = { Country = ["fr"] }

This can kinda work but it also affects or breaks /fr links for people in France.
(Another side effect is that the SSG prerender seems to omit the root /fr page.)

How do other projects tackle this?

Many thanks,
George

PS: We’ve also discovered that redirects with accents do not work.
Both of these are defined in our _redirects file but only one works.
Do we need to encode non-ascii characters in some way?
https://eu.yotoplay.com/demarrage
https://eu.yotoplay.com/démarrage

Hey there, @George_A :wave:

Regarding redirects with accent marks, this thread should be useful for you. It looks like a fellow customer encountered this question last month, and using %C3%A9 instead of é worked.

Regarding language redirects and NextJS, I have looped in one of our Support Engineers. Thanks for your patience!

1 Like