Question: I am tring to create default controller for no matter what URL you access to.  

Meaning, custom 404.

```
class MY_Exceptions extends CI_Exceptions
{
var $ci;

public function __construct()
{
    parent::CI_Exceptions();
    $this->ci =& get_instance();
}

function show_404($page = '')
{
  //load view here

}

```

} 

I am getting get\_instance is undefined. (because it was defined after the libraries get called)  

Is there a way to create custom 404 controller in codeignigter 1.7.2 without playing with the system core code. 

Thanks

Answer: 
If you just want to customize the 404 page, you can do so under the `/system/application/errors/error_404.php` page. The one caveat with this is that you can't use the `$this` object, it's strictly HTML/CSS or built-in PHP (no access to your libraries, models, etc.).

This is the page that CodeIgniter will display by default when it can't find a controller to handle a request.

Not sure if that's why you're trying to do or not, but that would be the simplest way to create a custom 404 page.
This should work fine. Make sure it's in the 'application/libraries' folder, and make sure your config has 'MY\_' set as the custom library name.

Also, if you are doing `function __construct(){}`, you can do `parent::__construct()`.