-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmiddleware.ts
46 lines (42 loc) · 1.33 KB
/
middleware.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { NextResponse, NextRequest } from "next/server";
export function middleware(request: NextRequest) {
const url = new URL(request.url);
switch (url.pathname) {
case "/work":
return NextResponse.redirect(new URL("/projects", request.url));
case "/home":
return NextResponse.redirect(new URL("/", request.url));
case "/highlights":
return NextResponse.redirect(new URL("/interviews", request.url));
case "/guestbook":
return NextResponse.redirect(new URL("/sign", request.url));
case "/s/v1":
return NextResponse.redirect("https://v1.ashish.top");
case "/s/gh":
return NextResponse.redirect("https://github.com/devashish2024");
case "/s/gh2":
return NextResponse.redirect("https://github.com/vortexprime24");
case "/s/dc":
return NextResponse.redirect(
"https://discordapp.com/users/1153023901203447940"
);
case "/s/mail":
return NextResponse.redirect("mailto:[email protected]");
default:
return NextResponse.next();
}
}
export const config = {
matcher: [
"/work",
"/home", // not needed
"/highlights", // redirect old routes to new ones
"/guestbook", // redirect old routes to new ones
// social and short links
"/s/v1", // short link to old portfolio
"/s/gh",
"/s/gh2",
"/s/dc",
"/s/mail",
],
};