Configure a custom static error page
SitecoreAI lets you create and configure site-specific 404 page not found or 500 error handling 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.
-
Because of Next.js limitations, this solution is not supported in a multisite setting when using JSS and Content SDK (Pages Router).
-
If you're using JSS version 21 or later with Next.js and you enable the
DISABLE_SSG_FETCHsetting, the JSS app won't fetch 404 or 500 custom error pages. -
For Content SDK apps that use Pages Router, you can disable the
GENERATE_STATIC_PATHSsetting and it won't fetch 404 or 500 custom error pages. But in Content SDK apps that use App Router, this limitation is not present.
To configure a custom static error page:
-
Create an error page in a site.
-
In Content editor, navigate to sitecore/Content/<site collection>/<site>/Settings .
-
In the Error Handling section, in the Page not found link field or the Server error page link, insert a link to the custom error page.
NoteIf you have previously created the site in the Content editor, and you can't find the Error Handling section, you might have forgotten to select the Error Handling option when creating your site collection.
-
To reflect the changes, you must republish the site root item.
In the site tree, click the Site item, then on the Publish tab, in the Publish group, click the Publish drop-down arrow, and select Publish item. Alternatively, right click the Site item and select Publish Item.
-
In the Publish Item dialog, click Republish. There's no need to republish child items.
-
Click Publish.