R
Reactiflux

help-threads-react

hoangvu12 – 05-14 Aug 29

NNguyen8/29/2023
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");
}
NNguyen8/29/2023
Fixed by moving middleware the same level as app
UUUnknown User8/30/2023
Message Not Public
Sign In & Join Server To View

Looking for more? Join the community!

R
Reactiflux

help-threads-react

Join Server