forward Request parameters to custom 404 page usin

2019-06-12 08:22发布

问题:

Is there a way to have the request parameters "forward on" to the custom error file in apache much like [QSA] does on rewrite rules?

if i send in www.foo.com/doesnotexist?bar=true

and i have this in vhost:

ErrorDocument 404 /customerrorpage

then it would call customerrorpage with:

customerrorpage?bar=true

回答1:

I know this is really old question, but it hasn't been answered and so in case someone else is searching the site for the answer I'll share what I know.

The Apache 2.2 ErrorDocument page says that when you have a Custom Error page which is a local page then a number of environment vars will be set which can be read from your customer error handler. One of the vars is REDIRECT_QUERY_STRING which will contain the query string that the original page had. So in your example the REDIRECT_QUERY_STRING would contain 'bar=true'.