Apache & Tomcat 404, 503 custom error page

Configure Tomcat and Apache to show custom 404 and 503 error pages. This should cover the cases when the either the page and/or application is not available.

1) Configure Apache httpd.conf configuration file in order to show a custom 404 and/or 503 error page:

# to handle 404 page not found
ErrorDocument 404 /404.htm

# to handle 503 application not available
ErrorDocument 503 /503.htm

Note(s):
  • The file 404 error page name can be anything you want and its path is relative to the applications DocumentRoot
  • Handling the 404 error by apache can be redundant, if the application is running then the 404 is catch and handled first by tomcat
2) Configure Tomcat web.xml file configuration file ion order to show a custom a404 error page:

<error-page>
    <error-code>404</error-code>
    <location>404.htm</location>
</error-page>

Comments

Popular posts from this blog

Oracle - duplicate fields in RECORD,TABLE or argument list are not permitted

Oracle - ORA-29282: invalid file ID, ORA-06512: at "SYS.UTL_FILE"