Fix: Move legacy asset rewrite to next.config.mjs beforeFiles for Next.js standalone compat
All checks were successful
All checks were successful
This commit is contained in:
@@ -62,6 +62,10 @@ const nextConfig = {
|
||||
source: '/wp-includes/:path*',
|
||||
destination: '/showcase/klz-cables.com/wp-includes/:path*',
|
||||
},
|
||||
{
|
||||
source: '/case-studies/assets/:directory/:path*',
|
||||
destination: '/showcase/:directory/assets/:directory/:path*',
|
||||
},
|
||||
]
|
||||
};
|
||||
},
|
||||
|
||||
@@ -47,7 +47,8 @@ export function middleware(request: NextRequest) {
|
||||
const targetPath = remainingPath.startsWith(`assets/${directory}/`)
|
||||
? `/${remainingPath}`
|
||||
: `/assets/${directory}/${remainingPath}`;
|
||||
|
||||
|
||||
console.log(`[Middleware] Rewriting to: /showcase/${directory}${targetPath}`);
|
||||
return NextResponse.rewrite(new URL(`/showcase/${directory}${targetPath}`, request.url));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user