Rectangle 27 0

apache How to use errordocument to redirect to a php file in the same folder?


How about this. In your root path, you set up a generic error.php file. However, all it does is parse the REQUEST_URI, check the path, see whether there is a custom error.php there, and include that. Could work, huh?

Note
Rectangle 27 0

apache How to use errordocument to redirect to a php file in the same folder?


The problem is that this is a program that I want to use in lots of places, and I don't want to modify the structure of the whole site each time. I really want to get it to work in an isolated folder, without affecting what's outside.

Why not have one ErrorDocument handle all the errors in all the folders? Might be much cleaner that way. You could then handle the individual case using $_SERVER["REQUEST_URI"] which should contain the original request if I remember correctly.

Note