hoangvu12 – 05-14 Aug 29

I'm using NextJS v13 app router, I have following folder structure. I want to redirect the url from / to /[lng] (with data logic), but for some reason the middleware.ts is not triggered. Here is the code
import { NextRequest, NextResponse } from "next/server";

export const config = {
matcher: "/",
};

export function middleware(req: NextRequest) {
return NextResponse.redirect("/anime");
}
import { NextRequest, NextResponse } from "next/server";

export const config = {
matcher: "/",
};

export function middleware(req: NextRequest) {
return NextResponse.redirect("/anime");
}
N
Nguyen233d ago
Fixed by moving middleware the same level as app
UU
Unknown User232d ago