Welcome Guest, Not a member yet? Register   Sign In
404 page - more info, please
#9

[eluser]cominus[/eluser]
Victorche - here is what I did:

In applications/config/routes/ approx line 42:
Code:
$route['404_override'] = 'errors/page_missing';

new file applications/controllers/errors.php:
Code:
<?php
class Errors extends CI_Controller {

    function __construct()
    {
        parent::__construct();
        $this->load->helper('url');
    }

    function page_missing()
    {
        $data['page_title'] = 'Error 404';
        $data['page_heading'] = 'The page you are looking for is missing!';
        $data['webmaster_email'] = '[email protected]';
        $this->load->view('header', $data);
        $this->load->view('page_missing', $data);
        $this->load->view('footer');
    }

    function forbidden()
    {
        $data['page_title'] = 'Error 403';
        $data['page_heading'] = 'Directory access is forbidden!';
        $this->load->view('header', $data);
        $this->load->view('forbidden', $data);
        $this->load->view('footer');
    }
}

new file applications/views/page_missing.php:
Code:
<div id="content-1col">

    <h1>&lt;?php echo $page_heading;?&gt;</h1>
    
    <p>Sorry! We have looked through the files but cannot find the URL you typed in.
    <br />Please check the menu, or the search box.
    <br />If that does not work, please contact the webmaster at &lt;?php echo safe_mailto($webmaster_email, '[Click Here to Contact]');?&gt;.</p>

</div>

The page_missing custom error page overrides the stock CI error message for 404.

The only problem I have (which is located at thread http://ellislab.com/forums/viewthread/181342/ ) is the forbidden option is not working - the custom 404 page missing error page is presented there also. So, that is a start.

Hope this is helpful.


Messages In This Thread
404 page - more info, please - by El Forum - 01-30-2011, 05:07 AM
404 page - more info, please - by El Forum - 01-30-2011, 06:06 AM
404 page - more info, please - by El Forum - 01-30-2011, 06:13 AM
404 page - more info, please - by El Forum - 01-30-2011, 08:39 AM
404 page - more info, please - by El Forum - 01-30-2011, 04:18 PM
404 page - more info, please - by El Forum - 01-30-2011, 06:39 PM
404 page - more info, please - by El Forum - 01-30-2011, 06:55 PM
404 page - more info, please - by El Forum - 02-17-2011, 10:33 AM
404 page - more info, please - by El Forum - 02-17-2011, 02:27 PM
404 page - more info, please - by El Forum - 03-25-2011, 03:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB