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.


Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation