CodeIgniter Forums
Problem in showing customized 404 error page - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Problem in showing customized 404 error page (/showthread.php?tid=61735)



Problem in showing customized 404 error page - codebigneer - 05-12-2015

To show custom 404 error page I did the following

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

where errors is my custom controller. Now above this is working if controller/method not found.But suppose if we passed some parameters after the method name them its not working and shoeing the default 404 page

For example: (domian name)/(controller)/(method)/(incorrect parameters) , it execute default 404 page rather then my custom 404 page

Is something I am missing ?


RE: Problem in showing customized 404 error page - Avenirer - 05-12-2015

That means that the CI found a controller and a method... So it won't be passed to errors controller. I think you should check for the parameters if they are correct and if not do a redirect, or even to put some default values to them.


RE: Problem in showing customized 404 error page - Hobbes - 05-12-2015

i have a controller name errors as well in it i have a function named: not_found

to override the default 404 i put this:


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

and it works perfectly fine.

in your case however, you could check for the parameter, and if it is valid or not. then do a redirect like so:

redirect('errors/not_found', 'refresh);