feat: add dynamic site settings, hero media, admin panels, and database integration
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import type { NextRequest } from "next/server";
|
||||
|
||||
const locales = ["tr", "en"];
|
||||
const defaultLocale = "tr";
|
||||
|
||||
export function proxy(request: NextRequest) {
|
||||
// Check if there is any supported locale in the pathname
|
||||
const { pathname } = request.nextUrl;
|
||||
|
||||
if (pathname.startsWith('/admin')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const pathnameHasLocale = locales.some(
|
||||
(locale) => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}`
|
||||
);
|
||||
|
||||
if (pathnameHasLocale) return;
|
||||
|
||||
// If no locale found, redirect to default locale
|
||||
request.nextUrl.pathname = `/${defaultLocale}${pathname}`;
|
||||
return NextResponse.redirect(request.nextUrl);
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
// Skip all internal paths (_next) and static files
|
||||
'/((?!api|_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)',
|
||||
],
|
||||
};
|
||||
Reference in New Issue
Block a user