import { NextResponse } from 'next/server' import type { NextRequest } from 'next/server' export async function middleware(request: NextRequest) { console.log('Middleware called for:', request.nextUrl.pathname) if (request.nextUrl.pathname === '/') { console.log('Redirecting / to /ro') return NextResponse.redirect(new URL('/ro', request.url)) } if (request.nextUrl.pathname.startsWith('/ro') || request.nextUrl.pathname.startsWith('/en')) { console.log('Allowing locale route:', request.nextUrl.pathname) return NextResponse.next() } console.log('Default behavior for:', request.nextUrl.pathname) return NextResponse.next() } export const config = { matcher: [ '/((?!api|_next|_vercel|.*\\..*).*)', ], }