custom error

How to customize the error pages?


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


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 different 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.

One important note: if there is an issue at the application level, these custom error pages might not be available or rendered as expected. To work around this issue, you can override the error pages at the front-end level. this way, they will be always available.