Reputation: 11
I'm usign i18next app directory and i'm wondoring if there is an option to remove language prefix from url
to have url like this
en
for home page example.com
en
for login page example.com/login
fr
for home page example.com
fr
for login page example.com/login
Upvotes: 1
Views: 1260
Reputation: 1
Take a look at rewrite something like:
if (locale === DEFAULT_LOCALE) {
return NextResponse.rewrite(new URL(`${locale}${pathname}`, request.url));
}
Upvotes: 0
Reputation: 11
In my opinion, you could try this flow:
en
for home page example.com
en
for login page example.com/login
fr
for home page example.com/fr
fr
for login page example.com/fr/login
And i found an example for this (nextjs 13, use app dir) and im using it, its work: https://carlogino.com/blog/nextjs13-i18n
Hope this help!
Upvotes: 1