Forcing CodeIgniter to show 404 page instead of any other error like 1064

20,935

You can force 404 with the method

show_404();

This will show 404 when u want it. In your case just catch your error and use this function.

Or you can set custom error handler, log it and display 404, thought i wouldn't recommend doing that.

Share:
20,935
Sumit Sinha
Author by

Sumit Sinha

Updated on July 09, 2022

Comments

  • Sumit Sinha
    Sumit Sinha almost 2 years

    How can replace error pages like

    A Database Error Occurred
    
    Error Number: 1064
    
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL     server version for the right syntax to use near 'order by rand()' at line 1
    

    with my website's default 404 error page?