In order to create a custom 404 page you must add an additional route for this page. When you have this route, the page is displayed instead of the default 404 page.
This ensures that 404 requests are routed through the route for the custom page and are cached according to the cache settings.
To create a 404 page, first create the route and then add a page.tsx file for that route.
Use the following sample to create the route.
Configure the cache settings for this route in production by setting dynamic to force-static and specifying the revalidate time to your preferred interval. For more information about cache settings, see Configure cache.
export const dynamic = 'force-static'; export const revalidate = 600;
In development mode, you can skip caching to immediately see changes while editing the page.
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important