如何使用基于404错误的mod_rewrite重定向到自定义错误页面

时间:2022-10-07 00:28:32

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:

当我返回404时,我试图使用mod_rewrite能够重定向到我的自定义html错误页面。现在,我运行了我的http服务器,运行了我的appserver(Websphere)。当我在appserver上取下一个服务时,它会返回一条消息,如下所示:

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

SRVE0255E:尚未定义处理localhost:80的WebGroup / Virtual Host。

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.

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

2 个解决方案

#1


Have you tried smth like this:

你试过像这样的smth:

ErrorDocument 404 /not-found.asp

#2


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.

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

#1


Have you tried smth like this:

你试过像这样的smth:

ErrorDocument 404 /not-found.asp

#2


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.

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