1
votes

For my error documents, I am using a single error page (error.html), which I redirect to using

ErrorDocument xxx http://www.example.com/error.html?error=xxx

This works fine, and I do the same for each of the 4xx and 5xx error codes, with the 'error=xxx' query string actually defining how the page looks (in terms of what text to display for what error was encountered).

I also need to capture the URL that was entered before the ErrorDocument redirect takes place, and append this to the ErrorDocument location as another query string

ErrorDocument xxx http://www.example.com/error.html?error=xxx**&url=yyy**

Am I able to do this? I know I read somewhere that it was possible with PHP, but I am avoiding PHP for this site (and it actually didn't work as expected when I did try).

I have looked at similar questions, but could not find one with that aided me.

1

1 Answers

1
votes

Remove http:// from ErrorDocument to avoid redirection for error condition like this:

ErrorDocument 404 /error.html?error=404
ErrorDocument 500 /error.html?error=500
...

This way entered URI is available as REQUEST_URI in your error.html since browser URI won't change.