2017-04-27

404 not found error redirect to a page

                                          tomcat custom http status 404 Error page configuration

If a requested page and it does not exist. tomcat default page look like this.

Here i am requesting for a page images in my application. But it is not present. Tomcat default error 404 page showing this page.

follow below step to override tomcat default 404 error page



You can put a custom page.

create a the page ' NotFound.html ' in your application home directory.

Add the following in web.xml file. (CATALINA_HOME/conf/web.xml)

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>



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


Re-Start your server.


No comments:

Post a Comment