docs: fix redirect infrastructure modules (#12238)
* docs: fix redirect infrastructure modules * change middleware
This commit is contained in:
@@ -62,6 +62,7 @@ export async function GET(req: NextRequest, { params }: Params) {
|
||||
headers: {
|
||||
"Content-Type": "text/markdown",
|
||||
},
|
||||
status: 200,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -3,18 +3,11 @@ import type { NextRequest } from "next/server"
|
||||
|
||||
export function middleware(request: NextRequest) {
|
||||
const path = request.nextUrl.pathname.replace("/index.html.md", "")
|
||||
if (
|
||||
!path.startsWith("/resources") &&
|
||||
!path.startsWith("/ui") &&
|
||||
!path.startsWith("/api") &&
|
||||
!path.startsWith("/user-guide")
|
||||
) {
|
||||
return NextResponse.rewrite(
|
||||
new URL(`/md-content${path.replace("/index.html.md", "")}`, request.url)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: "/:path*/index.html.md",
|
||||
matcher: "/((?!resources|api|ui|user-guide).*)index.html.md",
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ export async function GET(req: NextRequest, { params }: Params) {
|
||||
headers: {
|
||||
"Content-Type": "text/markdown",
|
||||
},
|
||||
status: 200,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ const nextConfig = {
|
||||
permanent: true,
|
||||
},
|
||||
{
|
||||
source: "/infrastructure-modules/:path*",
|
||||
source: "/architectural-modules/:path*",
|
||||
destination: "/infrastructure-modules/:path*",
|
||||
permanent: true,
|
||||
},
|
||||
|
||||
@@ -43,6 +43,7 @@ export async function GET(req: NextRequest, { params }: Params) {
|
||||
headers: {
|
||||
"Content-Type": "text/markdown",
|
||||
},
|
||||
status: 200,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ export async function GET(req: NextRequest, { params }: Params) {
|
||||
headers: {
|
||||
"Content-Type": "text/markdown",
|
||||
},
|
||||
status: 200,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user