Fix: Move legacy asset rewrite to next.config.mjs beforeFiles for Next.js standalone compat
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 9s
Build & Deploy / 🏗️ Build (push) Successful in 6m6s
Build & Deploy / 🚀 Deploy (push) Successful in 23s
Build & Deploy / 🩺 Smoke Test (push) Successful in 4s
Build & Deploy / 🔔 Notify (push) Successful in 3s

This commit is contained in:
2026-05-06 10:51:50 +02:00
parent d5f36274aa
commit acb9c3df38
2 changed files with 6 additions and 1 deletions

View File

@@ -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*',
},
]
};
},

View File

@@ -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));
}
}