We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f1f1370 commit 9cd96aeCopy full SHA for 9cd96ae
apps/codingcatdev/src/hooks.server.ts
@@ -0,0 +1,14 @@
1
+import { redirect, type Handle } from '@sveltejs/kit';
2
+
3
+export const handle = (async ({ event, resolve }) => {
4
+ if (event.url.pathname.startsWith('/tutorials')) {
5
+ throw redirect(301, '/posts');
6
+ }
7
8
+ if (event.url.pathname.startsWith('/tutorial')) {
9
+ throw redirect(301, `/post/${event.url.pathname.split('/').at(-1)}`);
10
11
12
+ const response = await resolve(event);
13
+ return response;
14
+}) satisfies Handle;
0 commit comments