如何根据 404 错误使用 mod_rewrite 重定向到自定义错误页面

发布于 2024-07-27 00:53:58 字数 329 浏览 8 评论 0原文

当返回 404 时,我尝试使用 mod_rewrite 能够重定向到我的自定义 html 错误页面。 现在,我的 http 服务器正在运行,并且我的应用程序服务器(Websphere)正在运行。 当我删除应用程序服务器上的服务时,它会返回一条消息,如下所示:

SRVE0255E:尚未定义用于处理 localhost:80 的 WebGroup/虚拟主机。

我希望能够根据响应重定向到我的自定义错误消息,而不是显示此错误消息。 尝试在 httpd.conf 文件中使用 ErrorDocument 指令不起作用,...但我听说这可以通过 mod_rewrite 来实现。 我不知道该怎么做。

I am trying to use mod_rewrite to be able to redirect to my custom html error page, when a 404 is returned. Right now, I have my http server running and my appserver(Websphere) running. When I take down a service on the appserver, it returns a message as follows:

SRVE0255E: A WebGroup/Virtual Host to handle localhost:80 has not been defined.

I want to be able to redirect to my custom error message, based on the response, rather than show this error message. Trying to use the ErrorDocument directive within the httpd.conf file does not work,... but I have heard that this is possible to do with mod_rewrite. I am not sure how to do this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

幻梦 2024-08-03 00:53:58

你有没有尝试过这样的事情:

ErrorDocument 404 /not-found.asp

Have you tried smth like this:

ErrorDocument 404 /not-found.asp
椵侞 2024-08-03 00:53:58

我们只能发布诸如“服务器正在维护中,感谢您的耐心等待!”之类的消息。 ,通过添加自定义属性。 我们无法将其重定向到自定义的静态页面。

We Can only post the messages like "Server under maintenance, Thanks for your patience!" , by adding the custom property. We cannot redirect it to the customized static page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文