0

This should be simpler. What do I need to define what should happen in place of a 404 error?

2 Answers 2

1

Check out my answer for CI Base URI Routing.

What you can do is extend CI's Router to re-route requests for non-existent controllers to your own error handling controller.

However, with CodeIgniter 2.0 (which I have been using with no problems at all in the real world), this is as easy as setting a 404_override config item that routes all invalid controller requests to your own controller in the exact same way without having to extend CI with your own library.

Either way, you could write your own error handling methods using the exact same functionality you would be able to use in any other controller.

Sign up to request clarification or add additional context in comments.

1 Comment

Cool... make sure you check out this article (philsturgeon.co.uk/news/2010/05/upgrading-to-codeigniter-2.0) on upgrading to CI 2.0 by SO user Phil Sturgeon (stackoverflow.com/users/124378/phil-sturgeon). Points out the steps you need to take for upgrading (and checkout the change log in the 2.0 user guide for new features like Drivers and package paths).
0

Read a little bit more on Error Handling for CodeIgniter. If that doesn't completely satisfy you, try editing your 404.php error file to make it do whatever you want it to do.

1 Comment

Nope, it's not allowing some stuff in the 404.php file, and that Error Handling document is sparse. I want to write a pre-controller hook to handle the errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.