2.15.1.2.6. Custom error pages

When an HTML error code is returned as a response to a URL request (for example, 404 Not Found), eXo Platform redirects users to a default error page where the error code is displayed together with an explanatory message. To replace the default error page with a customized one, the configuration explained below needs to be performed.

  1. Create the actual error pages and place them in the gatein/gatein.ear/portal.war/ directory.

  2. For each error code that shall have its custom error page, add the <error-page> element to the gatein/gatein.ear/portal.war/WEB-INF/web.xml file. This element specifies what page is displayed when the particular error code is returned.

    The sample code below ensures that the my404.html page is displayed when the 404 error code is returned.

    
    <error-page>
      <error-code>404</error-code>
      <location>/my404.html</location>
    </error-page>
  3. Specify the error page locations as static resources in the controller.xml file. The code sample below demonstrates this configuration for the /my404.html path.

    
    <route path="/my404.html">
      <route-param qname="gtn:handler">
     <value>staticResource</value>
      </route-param>
    </route>

    Without this configuration, the portal tries to resolve /my404.html as a name of a portal or another resource. This results in unwanted redirection to /portal/my404.html It is therefore necessary to configure the error page locations as static resources.

When all the previous steps are performed, users are redirected to the specified custom error pages when the respective error codes are returned as a response to a URL request.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus