Customize an Error Page

Last modified by Eleni Cojocariu on 2026/09/25 02:50

Content

Steps

Create the wiki page that replaces one of the four error pages, none of which exists until you do, with administration rights on the wiki it is created in:

CasePage to createWhereHTTP status
The wiki does not existXWiki.WikiDoesNotExistthe main wiki, because the template runs with the main wiki as its context404
The page does not existXWiki.DocumentDoesNotExistthe wiki concerned404, and 400 when the same page answers a template that cannot be evaluated
The attachment does not existXWiki.AttachmentDoesNotExistthe wiki concerned404
Access is deniedXWiki.AccessDeniedthe wiki concerned403, or 401 when the request used basic authentication
  1. Open the edit URL of the page you need (/bin/edit/XWiki/DocumentDoesNotExist for the missing-page case), which creates it.
  2. Write what your readers should see, and save. Anything a page can hold works.

    custom-error-page-editor.png

  3. Open a page that does not exist. Your content is now what the reader gets, and the response is still a 404, so search engines and monitoring see no change.

    custom-error-page-result.png

FAQ

Can I replace the whole template instead of its content?

Yes, for three of the four cases: xwiki.wiki_exception (default wikidoesnotexist), xwiki.access_exception (accessdenied) and xwiki.attachment_exception (attachmentdoesnotexist) name the template each case renders, and xwiki.user_exception and xwiki.invalid_url_exception do the same for the inactive-user and invalid-URL screens. None of them appears in the shipped xwiki.cfg, and there is none for the missing-page screen, which comes from the skin. A replacement template runs instead of everything described here, so it is a skin-level change rather than a configuration one.

Where do I put the page in a subwiki?

In the subwiki itself, except for XWiki.WikiDoesNotExist: by the time that screen is rendered the wiki is precisely what could not be found, so it is read from the main wiki.

Get Connected