Wiki source code of Customize an Error Page
Last modified by Eleni Cojocariu on 2026/09/25 02:50
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | Create the wiki page that replaces one of the four [[error pages>>doc:documentation.xs.admin.configuration.error-pages.WebHome]], none of which exists until you do, with administration rights on the wiki it is created in: | ||
| 2 | |||
| 3 | |=Case|=Page to create|=Where|=HTTP status | ||
| 4 | |The wiki does not exist|##XWiki.WikiDoesNotExist##|the main wiki, because the template runs with the main wiki as its context|404 | ||
| 5 | |The page does not exist|##XWiki.DocumentDoesNotExist##|the wiki concerned|404, and 400 when the same page answers a template that cannot be evaluated | ||
| 6 | |The attachment does not exist|##XWiki.AttachmentDoesNotExist##|the wiki concerned|404 | ||
| 7 | |Access is denied|##XWiki.AccessDenied##|the wiki concerned|403, or 401 when the request used basic authentication | ||
| 8 | 1. Open the edit URL of the page you need (##/bin/edit/XWiki/DocumentDoesNotExist## for the missing-page case), which creates it. | ||
| 9 | 1. Write what your readers should see, and save. Anything a page can hold works.((( | ||
| 10 | {{image reference="custom-error-page-editor.png" size="extra" alt="The wiki editor of XWiki.DocumentDoesNotExist holding a title and a short message"/}} | ||
| 11 | ))) | ||
| 12 | 1. 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.((( | ||
| 13 | {{image reference="custom-error-page-result.png" size="large" alt="A page that does not exist showing the custom message instead of the standard notice"/}} | ||
| 14 | ))) |