HushPe - 19 October 2006 12:21 AM
But… That 404 page doesn’t allow you to use any of the nice stuff CI does, like the URL helper. So all my anchor and base_url commands don’t work.
Right, that’s because the CI object doesn’t exist until a valid controller is found. If there is no controller, CI won’t ever be fully instantiated (remember that controllers extend the main CI controller, which allow everything to work as it does), so helpers and such won’t be available.
There’s another reason that I chose to keep 404 pages lean and simple: Performance. If you’ve ever examined the server logs on a busy site you’ll see that crawlers like Google can hammer a site with invalid requests. I’ve seen search engines produce literally thousands of hits to nonexistent pages. Do you really want your 404s to use all the resources of your application, just like you would with valid pages? I sure don’t. IMO 404s should be as lightweight as possible since their only purpose is to send a 404 header and a bit of info.