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.