简体   繁体   中英

How to change default error page for tomcat on server level and not on the application level?

I have an application on Tomcat as https:abc:8443/appname/login which I use. I have configured the application such that if I search https://abc:8443/appname/prasfag.txt , my custom error page gets displayed.

However if I search https://abc:8443/prags.txt , the tomcat shows the default Error 404 page. I want the tomcat to show a custom page when I access https://abc:8443/prags.txt .

How can I configure this?

In your tomcat web.xml you can configure HTTP redirect pages. Just insert

<error-page>
 <error-code>-xxx-</error-code>
 <location>/your/custom/html/path.html</location>
</error-page>

in your web.xml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM