Generate a custom static error page
SXA lets you set site-specific 404 and 500 error pages. When an error occurs, visitors are redirected to one of these static error pages.
404 custom error pages are multi-lingual and are, by default, displayed in the context language of the website visitor. If a website visitor requests a page in, for example, Italian, but the page does not exist in Italian, they are redirected to a 404 page in Italian:
-
If a 404 page does not exist in the language requested by a website visitor, they are redirected to a 404 page in the default language of the website.
-
If a 404 page does not exist in the default language of the website, the website visitor is redirected to the standard Sitecore 404 page.
-
For a page not found (404) error page, create the page under your Sitecore instance.
-
For a server error (500) page, create the page on the website of the rendering host. The Server error page link field in the Content Editor is inactive.
-
If you're using JSS version 21 or later with Next.js and you enable the
DISABLE_SSG_FETCH
setting, the JSS app won't fetch 404 or 500 custom error pages.
To generate a static 404 error page:
-
Create your error page.
-
Publish the error page.
-
Navigate to sitecore/Content/<site collection>/<site>/Settings .
-
In the Error Handling section, in the Page not found link field, insert a link to the custom error page.
NoteIf you can't find the Error Handling section, you might have forgotten to select the Error Handling option when creating your site collection.