简体   繁体   English

如何在服务器级别而不是在应用程序级别更改 tomcat 的默认错误页面?

[英]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.我在 Tomcat 上有一个应用程序作为https:abc:8443/appname/login我使用。 I have configured the application such that if I search https://abc:8443/appname/prasfag.txt , my custom error page gets displayed.我已经配置了应用程序,如果我搜索https://abc:8443/appname/prasfag.txt ,我的自定义错误页面就会显示出来。

However if I search https://abc:8443/prags.txt , the tomcat shows the default Error 404 page.但是,如果我搜索https://abc:8443/prags.txt ,则 tomcat 显示默认的错误 404 页面。 I want the tomcat to show a custom page when I access https://abc:8443/prags.txt .我希望 tomcat 在我访问https://abc:8443/prags.txt时显示自定义页面。

How can I configure this?我该如何配置?

In your tomcat web.xml you can configure HTTP redirect pages.在您的 tomcat web.xml 中,您可以配置 Z293C9EA246FF9985DC686F62A650F7 重定向页面。 Just insert只需插入

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

in your web.xml在你的 web.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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