Custom error pages
If you want to add custom error pages, you can follow the standard process described here: Custom error pages.
When the URL of the custom error page contains the error code (for example, ~/404), you must add an additional Next.js route to serve it. Without this route, the page cannot be edited in the backend. To see the supported error codes, see Supported error codes.
Configure settings
- In Sitefinity CMS backend, navigate to Administration » Settings » Advanced » Pages » Custom Error Pages » Error Types » 404.
- 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.
- Navigate to // src/app/404/page.tsx.
-
Use the following sample to create the route.