Replies: 1 comment
-
I don't know if this will come back to haunt me later, but: Adjusting request.nextUrl.pathname to the defaultLocale when the root-path is being requested does the trick! import createMiddleware from 'next-intl/middleware'
import { routing } from '@/i18n/routing'
const intlMiddleware = createMiddleware(routing)
export default async function middleware(request) {
if(request.nextUrl.pathname === "/") {
request.nextUrl.pathname = "/" + routing.defaultLocale
}
const response = await intlMiddleware(request)
return response
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi *,
any chance to prevent the redirect when requesting the root-path and just use the default language here? Handling everything else (also default lang) under its /lang - scope is totally fine...
Beta Was this translation helpful? Give feedback.
All reactions