chore: shift showcase asset rewrites to next.config.mjs for standalone stability
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 8s
Build & Deploy / 🏗️ Build (push) Successful in 10m54s
Build & Deploy / 🚀 Deploy (push) Successful in 23s
Build & Deploy / 🩺 Smoke Test (push) Failing after 4s
Build & Deploy / 🔔 Notify (push) Successful in 2s
Nightly QA / 🔗 Links & Deps (push) Successful in 3m56s
Nightly QA / 🎭 Lighthouse (push) Successful in 4m22s
Nightly QA / 🔍 Static Analysis (push) Successful in 4m40s
Nightly QA / 📝 E2E (push) Successful in 5m5s
Nightly QA / 🔔 Notify (push) Has been skipped
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 8s
Build & Deploy / 🏗️ Build (push) Successful in 10m54s
Build & Deploy / 🚀 Deploy (push) Successful in 23s
Build & Deploy / 🩺 Smoke Test (push) Failing after 4s
Build & Deploy / 🔔 Notify (push) Successful in 2s
Nightly QA / 🔗 Links & Deps (push) Successful in 3m56s
Nightly QA / 🎭 Lighthouse (push) Successful in 4m22s
Nightly QA / 🔍 Static Analysis (push) Successful in 4m40s
Nightly QA / 📝 E2E (push) Successful in 5m5s
Nightly QA / 🔔 Notify (push) Has been skipped
This commit is contained in:
@@ -46,6 +46,25 @@ const nextConfig = {
|
||||
},
|
||||
];
|
||||
},
|
||||
async rewrites() {
|
||||
return {
|
||||
beforeFiles: [
|
||||
// Map Patttern: Global assets moved into KLZ showcase folder
|
||||
{
|
||||
source: '/assets/klz-cables.com/:path*',
|
||||
destination: '/showcase/klz-cables.com/assets/klz-cables.com/:path*',
|
||||
},
|
||||
{
|
||||
source: '/wp-content/:path*',
|
||||
destination: '/showcase/klz-cables.com/wp-content/:path*',
|
||||
},
|
||||
{
|
||||
source: '/wp-includes/:path*',
|
||||
destination: '/showcase/klz-cables.com/wp-includes/:path*',
|
||||
},
|
||||
]
|
||||
};
|
||||
},
|
||||
// In Standalone mode, Next.js expects the tracing root to be the monorepo root
|
||||
outputFileTracingRoot: path.join(dirname, '../../'),
|
||||
};
|
||||
|
||||
@@ -18,13 +18,6 @@ export function middleware(request: NextRequest) {
|
||||
// Normalize pathname to ensure we're matching correctly
|
||||
const path = pathname;
|
||||
|
||||
// Map Pattern 1: Global assets (directly under root)
|
||||
// These are often mirrored by wget/discovery engines into a domain-named subfolder
|
||||
if (path.startsWith('/wp-content/') || path.startsWith('/wp-includes/') || path.startsWith('/assets/')) {
|
||||
// Brute force: Re-route to the known KLZ showcase directory
|
||||
return NextResponse.rewrite(new URL(`/showcase/klz-cables.com${path}`, request.url));
|
||||
}
|
||||
|
||||
// Map Pattern 2: Showcase-prefixed assets (used for relative links within the showcase)
|
||||
const showcaseMatch = path.match(/^\/(?:case-studies|work|blog)\/([^\/]+)\/(.*)/);
|
||||
if (showcaseMatch) {
|
||||
|
||||
Reference in New Issue
Block a user