How to customize the error pages?

  Written by The Jahia Team
 
Sysadmins
Developers
   Estimated reading time:
7.1 7.2

The customer would like to know the way to custom the error pages in Jahia 7.

Answer

The first solution is to directly customize the JSP  webapps/ROOT/errors/error_404.jsp. This should be done if this change is global (same 404 error page for all websites.)

This change can be packaged into a module. This is useful if you want to have a more complex 404 error page or many different ones. It is also easier to deploy. In order to package it into a module. You should package errors/error_404.jsp into a war file.

This change could be also included in a template set for instance. Thus all sites created with this template set will have these customized error pages.

The second solution is to customize the error pages per site. For that, the error pages should be differed according to the site key.
You have to include the site key in the path folder as below /errors/sites/mySite/error_4xx.jsp  The error page defined in the folder "mySite" will be only used by the site with the site key "mySite". 

Finally, you can also deploy Customize error pages module. This module allows you to designate error pages in site-settings. The module does an automatic forward to these error pages in case of error. Note that this is a community module.

Related links