Compare commits
No commits in common. "ca697cf6f6d2c73b0defc82b204838644a50dad0" and "d56ad18426c0c1ab39c9825044325c9b3b12ca48" have entirely different histories.
ca697cf6f6
...
d56ad18426
@ -19,19 +19,6 @@ export function middleware(request: NextRequest) {
|
||||
request.headers.set("x-site-name", siteName);
|
||||
request.headers.set("x-meta-desc", metaDesc);
|
||||
|
||||
// redirect for /blog/<slug>/ path
|
||||
const blogPathRegex = /^\/blog\/([^\/]+)(\/[^\/]*)*\/?$/;
|
||||
if (blogPathRegex.test(path)) {
|
||||
const newBlogPath = path.replace(/^\/blog/, "") || "/";
|
||||
return NextResponse.redirect(`${mainUrl}${newBlogPath}`, 301);
|
||||
}
|
||||
// redirect for /about/<slug>/ path
|
||||
const aboutPathRegex = /^\/about\/([^\/]+)(\/[^\/]*)*\/?$/;
|
||||
if (aboutPathRegex.test(path)) {
|
||||
const newAboutPath = path.replace(/^\/about/, "") || "/";
|
||||
return NextResponse.redirect(`${mainUrl}${newAboutPath}`, 301);
|
||||
}
|
||||
|
||||
return NextResponse.next({
|
||||
request: {
|
||||
// New request headers
|
||||
|
Loading…
x
Reference in New Issue
Block a user