Closed eggcaker closed 4 months ago
Not tested yet, but you would need to have those pages doubled... also present in the app directory... and then you would also need to adapt the middleware.ts file to not redirect if the detected language is the default one...
it'works , but is only way can do that ? mean i need copy all layouts and pages
You may also try something like this instead:
if (
!languages.some(loc => req.nextUrl.pathname.startsWith(`/${loc}`)) &&
!req.nextUrl.pathname.startsWith('/_next')
) {
+ if (lng === fallbackLng) {
+ return NextResponse.rewrite(new URL(`/${lng}${req.nextUrl.pathname}`, req.url))
+ }
return NextResponse.redirect(new URL(`/${lng}${req.nextUrl.pathname}`, req.url))
}
yes, it's works too, just one issue , when access webiste.com/ has a loop redirect to /en/en/en/en/en/en/en.... haha but, thanks for help, i'll try fix that loop redirect go with second way.
🚀 Feature Proposal
when acess http://website/route-one will render http://website/en/route-one (en as default locale)
Motivation
Please outline the motivation for the proposal.
Example
Please provide an example for how this feature would be used.