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: {
|
headers: {
|
||||||
"Content-Type": "text/markdown",
|
"Content-Type": "text/markdown",
|
||||||
},
|
},
|
||||||
|
status: 200,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,18 +3,11 @@ import type { NextRequest } from "next/server"
|
|||||||
|
|
||||||
export function middleware(request: NextRequest) {
|
export function middleware(request: NextRequest) {
|
||||||
const path = request.nextUrl.pathname.replace("/index.html.md", "")
|
const path = request.nextUrl.pathname.replace("/index.html.md", "")
|
||||||
if (
|
return NextResponse.rewrite(
|
||||||
!path.startsWith("/resources") &&
|
new URL(`/md-content${path.replace("/index.html.md", "")}`, request.url)
|
||||||
!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 = {
|
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: {
|
headers: {
|
||||||
"Content-Type": "text/markdown",
|
"Content-Type": "text/markdown",
|
||||||
},
|
},
|
||||||
|
status: 200,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ const nextConfig = {
|
|||||||
permanent: true,
|
permanent: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
source: "/infrastructure-modules/:path*",
|
source: "/architectural-modules/:path*",
|
||||||
destination: "/infrastructure-modules/:path*",
|
destination: "/infrastructure-modules/:path*",
|
||||||
permanent: true,
|
permanent: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ export async function GET(req: NextRequest, { params }: Params) {
|
|||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "text/markdown",
|
"Content-Type": "text/markdown",
|
||||||
},
|
},
|
||||||
|
status: 200,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ export async function GET(req: NextRequest, { params }: Params) {
|
|||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "text/markdown",
|
"Content-Type": "text/markdown",
|
||||||
},
|
},
|
||||||
|
status: 200,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user