5th March 2023

When rendering pages with dynamic routes in Next.js server side you can return the code below to redirect to a 404 page when no data is available

 return {
     notFound: true,
   }