Customize an Error Page

Last modified by Eleni Cojocariu on 2026/09/11 19:20

Content

Steps

Each of the four error pages is a wiki page that does not exist until you create it. Create the one that matches the case you want to change:

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

You need administration rights on the wiki you create the page in.

  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