Tomcat

Customised 404 error page | Go to top

To customise the 404 "page not found" error page that is displayed by Tomcat, simply add the following to the web.xml file below the closing welcome-file-list tag:

     <error-page>
      <error-code>404</error-code>

      <location>/error/404.html</location>
     </error-page>
   

You can add this to Tomcat's web.xml file or an individual web application's web.xml file. Please note the following:

  • The error-page tag MUST come immediately after the closing welcome-file-list tag.
  • The location of the error page is relative to the webapp's root and can have any name.

Last modified: 07/05/2006 (most likely earlier as a site migration in 2006 reset some dates) Tags: (none)

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top