Speed up widget development with Sitefinity MCP server. Learn more...

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.

NEW TO SITEFINITY?

Want to learn more?

Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.

Get started with Integration Hub | Sitefinity Cloud

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 your 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 ASP.NET Core and take advantage of its decoupled architecture and modern development model.

Was this article helpful?