Reputation: 5589
any ideas how to replace Apache HTTP 500 (Internal Server Error) error by HTTP 503 (Service Unavailable) on PHP error once PHP error displaying is off? This is much better option to inform spiders to back to the site soon...
P.S. would be great to be able to append Retry-After to the 50x error codes if possible...
cheers, /Marcin
Upvotes: 1
Views: 3411
Reputation: 1638
I wonder if you could do something like an Apache
Redirect 503 /error/500 /maintenance.html
on an
ErrorDocument 500 /error/500
directive?
Upvotes: 0
Reputation: 449783
I assume you are referring to PHP's new (since 5.2.4) default behaviour of throwing a 500 if an error occurs, and no other output is being made.
AFAIK, that behaviour is hard-coded, you won't be able to change that without changing PHP itself.
The easiest way may be setting up a custom error handler, and having that throw a 503 for you:
header("HTTP/1.1 503 Service Unavailable");
echo "--- error message here -----";
die();
Upvotes: 2