Testing htaccess for 500 server error without actual error

I created a folder called http500 in the www root

I put a .htaccess file into that folder with the following:

Redirect 500 /http500

I then opened it http://example.com/http500

You can try out different error pages

Redirect 501 /http500

or

Redirect 502 /http500

or

Redirect 503 /http500

It did not require any server restart, the change applied immediately.

Sources:
https://stackoverflow.com/a/8687536/534883
https://bibwild.wordpress.com/2013/06/05/how-to-make-apache-fake-a-500-http-response/


make sure that the error page appears, when site really crashes?

It depends what you mean by "when the site really crashes". A "500 Internal Server Error" is such a generic error... if the server is unable to process the request for whatever reason and there is no other suitable response then it defaults to a 500 error response.

The "problem" here is that for the majority of uncontrolled 500 errors, defining the 500 ErrorDocument late in .htaccess is simply too late to have any effect.

You can trap more 500 error responses if the 500 ErrorDocument is defined earlier in the server config or <VirtualHost> container - this is where it should be defined. But even then, depending on the severity of the error, the custom ErrorDocument may still not be called.

You can "artificially" trigger a 500 response as @TimoHuovinen suggests and this would trigger your custom 500 ErrorDocument, however, whether this triggers when your "site really crashes" is another matter entirely.