单个 ErrorDocument 指令用于捕获所有错误 (.htaccess) [英] Single ErrorDocument directive to catch all errors (.htaccess)

查看:24
本文介绍了单个 ErrorDocument 指令用于捕获所有错误 (.htaccess)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有类似通配符的指令来捕获所有可能的错误并在单个自定义错误页面中处理它们?

Is there something like a wildcard directive to catch all possible errors and deal with them in a single custom error page?

ErrorDocument 404 /error.php?code=404
ErrorDocument 403 /error.php?code=403
...
ErrorDocument NNN /error.php?code=NNN #possible use of RegExp?

我知道我可能不会在这里处理很多自定义错误页面,但我对此很好奇.

I know I probably won't be dealing with a lot of custom error pages here, but I'm curious about this.

推荐答案

那是不可能的.您需要为每个要以不同于默认错误处理程序的方式处理的状态代码使用 ErrorDocument 指令.

That is not possible. You need to have a ErrorDocument directive for each status code you want to handle differently than with the default error handler.

这篇关于单个 ErrorDocument 指令用于捕获所有错误 (.htaccess)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆