Custom error pages

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.

Configure settings

  1. In Sitefinity CMS backend, navigate to Administration » Settings » Advanced » Pages » Custom Error Pages » Error Types » 404.
  2. Check the Redirect option.

This ensures that 404 requests are routed through the route for the custom page and are cached according to the cache settings.

Create the routing

To create a 404 page, first create the route and then add a page.tsx file for that route.

  1. Navigate to // src/app/404/page.tsx.
  2. 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.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

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.

Web Security for Sitefinity Administrators

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.

Foundations of Sitefinity ASP.NET Core Development

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.

Was this article helpful?