Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions apps/guide/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ export function middleware(request: NextRequest) {
return NextResponse.redirect(new URL(newUrl.pathname, request.url));
}

return NextResponse.redirect(new URL('/legacy', request.url));
// Redirect old urls to /legacy
if (!request.nextUrl.pathname.startsWith('/legacy') && !request.nextUrl.pathname.startsWith('/voice')) {
const newUrl = request.nextUrl.clone();
newUrl.pathname = `/legacy${newUrl.pathname}`;
return NextResponse.redirect(new URL(newUrl.pathname, request.url));
}

return NextResponse.next();
}

export const config = {
matcher: ['/', '/guide/:path*'],
matcher: ['/((?!_next|api|og|.*\\..*|_static).*)'],
};