mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
* refactor: remove guide route prefix * chore: implement backwards compat redirect * Change guide redirect destination and permanence Updated the redirect destination and permanence for the guide route. --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
17 lines
508 B
TypeScript
17 lines
508 B
TypeScript
import { NextResponse, type NextRequest } from 'next/server';
|
|
|
|
export function middleware(request: NextRequest) {
|
|
// TODO: Remove this eventually
|
|
if (request.nextUrl.pathname.startsWith('/guide/')) {
|
|
const newUrl = request.nextUrl.clone();
|
|
newUrl.pathname = newUrl.pathname.replace('/guide/', '/');
|
|
return NextResponse.redirect(new URL(newUrl.pathname, request.url));
|
|
}
|
|
|
|
return NextResponse.redirect(new URL('/legacy', request.url));
|
|
}
|
|
|
|
export const config = {
|
|
matcher: ['/', '/guide/:path*'],
|
|
};
|