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*',
|
source: '/wp-includes/:path*',
|
||||||
destination: '/showcase/klz-cables.com/wp-includes/:path*',
|
destination: '/showcase/klz-cables.com/wp-includes/:path*',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
source: '/case-studies/assets/:directory/:path*',
|
||||||
|
destination: '/showcase/:directory/assets/:directory/:path*',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ export function middleware(request: NextRequest) {
|
|||||||
? `/${remainingPath}`
|
? `/${remainingPath}`
|
||||||
: `/assets/${directory}/${remainingPath}`;
|
: `/assets/${directory}/${remainingPath}`;
|
||||||
|
|
||||||
|
console.log(`[Middleware] Rewriting to: /showcase/${directory}${targetPath}`);
|
||||||
return NextResponse.rewrite(new URL(`/showcase/${directory}${targetPath}`, request.url));
|
return NextResponse.rewrite(new URL(`/showcase/${directory}${targetPath}`, request.url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user