This commit is contained in:
Harun CAN
2026-01-30 04:59:11 +03:00
parent 1f123b9f65
commit 95a700aec9
3 changed files with 7 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
import { redirect } from 'next/navigation';
export default async function Page() {
redirect('/home');
export default async function RootPage({ params }: { params: Promise<{ locale: string }> }) {
const { locale } = await params;
redirect(`/${locale}/home`);
}

View File

@@ -1,11 +0,0 @@
import createMiddleware from 'next-intl/middleware';
import { routing } from './i18n/routing';
export default createMiddleware(routing);
export const config = {
// Match all pathnames except for
// - … if they start with `/api`, `/_next` or `/_vercel`
// - … the ones containing a dot (e.g. `favicon.ico`)
matcher: ['/((?!api|_next|_vercel|.*\\..*).*)']
};

View File

@@ -36,8 +36,11 @@ export default function proxy(req: NextRequest) {
return; // Return undefined to pass through without modification
}
// Add explicit public paths that might not be in NAV_ITEMS (like pages)
const additionalPublicPaths = ['/games', '/games/.*'];
const publicPathnameRegex = RegExp(
`^(/(${routing.locales.join("|")}))?(${publicPages.flatMap((p) => (p === "/" ? ["", "/"] : p)).join("|")})/?$`,
`^(/(${routing.locales.join("|")}))?(${[...publicPages, ...additionalPublicPaths].flatMap((p) => (p === "/" ? ["", "/"] : p)).join("|")})/?$`,
"i",
);
const isPublicPage = publicPathnameRegex.test(req.nextUrl.pathname);