CodeIgniter has /system/application/errors/error_404.php which is displayed when there is a 404 due to what is effectively a "controller not found" condition. However, for my project, I really need this error to be handled just like it is when a method is missing from the controller class. In that case, I show a normal view with a pretty "Page not found: Perhaps you meant this?..." page complete with database-generated navigation etc.
My thoughts are that I could do one of two things:
- Create a
header("Location: /path/to/error_page")
call to redirect to an existing (or special) controller's 404 handler - Add some kind of default router to handle it.
What is the best way to achieve the required result? Are there any pitfalls to watch out for?