How can i trigger 500 Internal Server Error or 404 Page Not Found Apache errors in PHP?
For 500 Internal Server Error i have tried
I know this is an old thread however...
You could render an iframe element into your view, and then set its height and width to 100% in the event of the error you are preparing to handle.
THAT SAID
I truly think that the best modern solution for this would be something like:
Error!
This would result in a proper error code for all users, and also a stack trace for dev if you set the $env variable to 'dev' on your dev stack.
No redirect, no hackery, secure unless you need to expose an error it won't. :)