Skip to content

Commit 5f7eefe

Browse files
fix(docs): catch-all routing (CopilotKit#515)
1 parent 29d669a commit 5f7eefe

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

docs/next.config.mjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,12 @@ export default withNextra({
1515
permanent: true,
1616
}
1717
]
18-
}
18+
},
19+
// This is needed for catch-all redirect of non existent rountes to the home page.
20+
// https://github.com/vercel/next.js/discussions/16749#discussioncomment-2992732
21+
async rewrites() {
22+
return {
23+
afterFiles: [{ source: "/:path*", destination: "/_404/:path*" }],
24+
};
25+
},
1926
});

docs/pages/[...rest].tsx

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/pages/_404/[...path].tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// This is needed for catch-all redirect of non existent rountes to the home page.
2+
// https://github.com/vercel/next.js/discussions/16749#discussioncomment-2992732
3+
export const Custom404 = () => <div></div>;
4+
5+
export const getServerSideProps = () => {
6+
return { redirect: { destination: "/", permanent: false } };
7+
};
8+
9+
export default Custom404;

0 commit comments

Comments
 (0)