1

I'm looking for a way to redirect to an /error.php page when a fatal php error occurs. I have htaccess setup to log errors, but how can I redirect on fatal error using htaccess?

0

1 Answer 1

2

Use header with a shutdown function to forward them on fatal error.

register_shutdown_function('forward_fatal');
function forward_fatal(){
    header("Location: error.php");
}
Sign up to request clarification or add additional context in comments.

1 Comment

Note that for this to work, you either enable output buffering or guarantee that no output has been sent prior to the error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.