Issue

Is there a way to create a custom error page for 404 and 500 errors in CQ3.x or CQ4.x?

Solution

Edit the following config file:/config/delivery/scripting.xml and add your own error handler for status 404 or 500. For example:

Note: Keep the line <error status="*" script="/libs/Errorhandler/status.ecma" type="ecma" /> that exists and put your handler after it.

ESP Script

<errorhandler>
    <error status="*" script="/libs/Errorhandler/status.ecma" type="ecma" />
    <error status="404" script="/path/to/your/script.esp" type="ecma" />
    ...
</errorhandler>

JSP Script

<errorhandler>
    <error status="*" script="/libs/Errorhandler/status.ecma" type="ecma" />
    <error status="404" script="/path/to/your/script.jsp" type="jsp" />
    ...
</errorhandler>

See the Script Handler Reference page.

Note:

  • Be careful not to name your script starting with numbers in the name (for example, 404.jsp is an invalid name). See here for more info about this issue.
  • For your error page to be displayed in Internet Explorer and Google Chrome, the number of characters output by the response must exceed 1000. Otherwise, IE and Chrome output their default error page.

Dette produktet er lisensiert i henhold til Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Innlegg på Twitter™ og Facebook dekkes ikke av Creative Commons-vilkår.

Juridiske merknader   |   Regler for personvern på nettet