Skip to main content
wpcrux.com

Back to all posts

How to Customize Error Pages In CodeIgniter?

Published on
9 min read
How to Customize Error Pages In CodeIgniter? image

Best Error Page Customization Tools to Buy in October 2025

+
ONE MORE?

To customize error pages in CodeIgniter, you can follow these steps:

  1. Open the application/config/routes.php file in your CodeIgniter application directory.
  2. Locate the $route['(:any)'] line, which is the default route for handling all requests.
  3. Add the following line above the default route:

$route['404_override'] = 'errors/custom_404';

This configures CodeIgniter to redirect all 404 (Not Found) errors to the specified custom_404 method in the errors controller.

  1. Create a new file called Custom404.php under the application/controllers directory. This will serve as our errors controller.
  2. Open the newly created Custom404.php file and add the following code: