is there any way to redirect to the default 404 page after your search query on the server component

export async function generateMetadata(
pageProps: PageProps
): Promise<Metadata> {
const page = await getPageData(pageProps);
return { title: page?.name ?? "Unable to find page" };
}

export default async function Home(pageProps: PageProps) {
const pageData = await getPageData(pageProps);
console.log("page", pageData);

if (!pageData) {
return new Response("No data found", {
status: 404,
});
}
export async function generateMetadata(
pageProps: PageProps
): Promise<Metadata> {
const page = await getPageData(pageProps);
return { title: page?.name ?? "Unable to find page" };
}

export default async function Home(pageProps: PageProps) {
const pageData = await getPageData(pageProps);
console.log("page", pageData);

if (!pageData) {
return new Response("No data found", {
status: 404,
});
}
Im not in a position where i dont want to build a custom 404 page because I have a lot more work to do, but essentially i need some form of method to redirect to nextjs 13 404 page when the slug doesnt match anything in my sluglist
2 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
MagerX
MagerX2y ago
you are a legend my friend
Want results from more Discord servers?
Add your server