How do I redirect to an error document (like 404) for MODx parse errors?
I am using Apache 2.2, Mysql 5.0.51 and Php 5
I have the error document defined in MODx manager as well as Error Documents defined in httpdconf in Apache as below:
ErrorDocument 400 /error_page.html
ErrorDocument 401 /error_page.html
ErrorDocument 403 /error_page.html
ErrorDocument 404 /error_page.html
ErrorDocument 405 /error_page.html
ErrorDocument 406 /error_page.html
ErrorDocument 409 /error_page.html
ErrorDocument 413 /error_page.html
ErrorDocument 414 /error_page.html
ErrorDocument 500 /error_page.html
ErrorDocument 501 /error_page.html
When I intentionally change the database configuration, the page displays the parse error. Is it possible to redirect to the error page?
Thanks.
George.
-
☆ A M B ☆
- 24,524 Posts
Not if PHP catches the error before MODx does. PHP will generate its own error page before MODx ever gets a chance to do anything. That’s why you often end up with a bunch of "headers already sent" errors along with a major PHP fatal error.
Thanks, but I have set ’display_errors’ to off in php.ini
Is there any other setting in php or modx that will help me redirect users to a nicer error page in case of a fatal error? We do have an error page set up in Modx for 404s.
George.