mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
refactor: remove guide route prefix (#11146)
* 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>
This commit is contained in:
16
apps/guide/src/middleware.ts
Normal file
16
apps/guide/src/middleware.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
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*'],
|
||||
};
|
||||
Reference in New Issue
Block a user