Neverlax
Neverlax

Reputation: 425

htaccess redirect on fatal php error?

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?

Upvotes: 1

Views: 437

Answers (1)

John V.
John V.

Reputation: 4670

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

register_shutdown_function('forward_fatal');
function forward_fatal(){
    header("Location: error.php");
}

Upvotes: 2

Related Questions