diff --git a/src/app/[locale]/layout.tsx b/src/app/[locale]/layout.tsx index 2a936e9..a50fe21 100644 --- a/src/app/[locale]/layout.tsx +++ b/src/app/[locale]/layout.tsx @@ -9,6 +9,8 @@ type Props = { params: Promise<{locale: string}>; }; +export const dynamicParams = false + export function generateStaticParams() { return routing.locales.map((locale) => ({locale})); } diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx index 69e7485..5e79f79 100644 --- a/src/app/not-found.tsx +++ b/src/app/not-found.tsx @@ -1,15 +1,5 @@ -import BaseLayout from '@/components/BaseLayout'; -import NotFoundPage from '@/components/NotFoundPage'; -import {routing} from '@/i18n/routing'; - -// This page renders when a route like `/unknown.txt` is requested. -// In this case, the layout at `app/[locale]/layout.tsx` receives -// an invalid value as the `[locale]` param and calls `notFound()`. +import { redirect } from 'next/navigation' export default function GlobalNotFound() { - return ( - - - - ); + return redirect('/') } diff --git a/src/middleware.ts b/src/middleware.ts index b250940..ff018df 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -14,6 +14,6 @@ export const config = { // Enable redirects that add missing locales // (e.g. `/pathnames` -> `/en/pathnames`) - '/((?!_next|_vercel|.*\\..*).*)' + '/((?!api|_next|_vercel|.*\\..*).*)' ] };