Kind sirs, I\'m using Codeigniter to build a blog. I might need a way to redirect a 404 error into a custom 404 page. Just like what Abduzeedo.com\'s 404 page. Is it possibl
Simple Solution.
Create your custom error or Page not found page within view.
Create a controller for error page. Within index function load the view of error page that you already created in previous step.
Now, Go to your application/config/routes.php
you should find $route['404_override'] = '';
Its the ''
mean its calling the default error page.
Now place your controller name for error page .
It will work.
Suppose my Controller for error page is 'error'
. and view page is 'notfound'
.
So, code for Error.php
controller will be:
load->view('notfound');
}
}
Now, I replaced $route['404_override'] = '';
to $route['404_override'] = 'error';
in
application/config/routes.php
.