Next.js Discord

Discord Forum

Separate next app for language locales. Possible?

Answered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
I'd like to use different nextjs apps for two different locales of my app, running on the same domain. As an example: I have two countires, UK and FR and wanna provide two language variations for each, like French and English.
From SEO point of view we use the following urls:

For France:
mydomain.com/fr-FR
mydomain.com/en-FR

For UK:
mydomain.com/en-UK
mydomain.com/fr-UK

And I would like to serve the two separate locales from two different repos (two different next app). So that let's say. next-app-fr repo serves fr-FR and en-FR (using e.g. next-i18next) and next-app-uk repo serves the en-UK and fr-UK.

I am stuck with it. I did try using zones (https://nextjs.org/docs/pages/building-your-application/deploying/multi-zones), with basePath (https://nextjs.org/docs/app/api-reference/next-config-js/basePath) and rewrites (https://nextjs.org/docs/app/api-reference/next-config-js/rewrites) following the next documentation but this is not exactly what I want to achieve.

Does anyone has any idea how to configure either vercel or next to enable serving a bunch of languages from one repo and another bunch from another?
Answered by joulev
Deploy like this with a basePath for each app, then host another app at mydomain.com that rewrites mydomain.com/fr/* to fr.mydomain.com/fr and so on
View full answer

2 Replies

Transvaal lionOP
I know that subdomain would technically solve this issue quickly, like fr.mydomain.com and uk.mydomain.com, but our SEO team do not want to go with this url structure.
@Transvaal lion I know that subdomain would technically solve this issue quickly, like fr.mydomain.com and uk.mydomain.com, but our SEO team do not want to go with this url structure.
Deploy like this with a basePath for each app, then host another app at mydomain.com that rewrites mydomain.com/fr/* to fr.mydomain.com/fr and so on
Answer