Welcome Guest, Not a member yet? Register   Sign In
404 Override Not Working
#10

(This post was last modified: 06-20-2017, 02:08 AM by reactionstudio.)

If you create the file: application/core/MY_Exceptions.php with the following code what happens?

PHP Code:
<?php


class MY_Exceptions extends CI_Exceptions {

    function 
__construct() {

        
parent::__construct();

    }

    public function 
show_404($page ''$log_error TRUE)
    {
        if (
is_cli())
        {
            
$heading 'Not Found';
            
$message 'The controller/method pair you requested was not found.';
        }
        else
        {
            
$heading '404 Page Not Found';
            
$message 'The page you requested was not found.';
        }

        
        if (
$log_error)
        {
            
log_message('error'$heading.': '.$page);
        }
        
        if( 
is_cli() ) {

            echo 
$this->show_error($heading$message'error_404'404);

        } else {
            
header("HTTP/1.0 404 Not Found");
            
            
            
header('location: http://www.yoursite.com/notfound');

        }
        exit(
4); // EXIT_UNKNOWN_FILE
    
}



dont forget to replace www.yoursite.com with your applications domain. If it works you'll need to change how the base_url is passed in but this should be enough to see if it makes progress towards a solution.
Reply


Messages In This Thread
404 Override Not Working - by wolfgang1983 - 06-20-2017, 01:18 AM
RE: 404 Override Not Working - by reactionstudio - 06-20-2017, 01:32 AM
RE: 404 Override Not Working - by wolfgang1983 - 06-20-2017, 01:33 AM
RE: 404 Override Not Working - by reactionstudio - 06-20-2017, 01:49 AM
RE: 404 Override Not Working - by wolfgang1983 - 06-20-2017, 01:59 AM
RE: 404 Override Not Working - by reactionstudio - 06-20-2017, 01:52 AM
RE: 404 Override Not Working - by wolfgang1983 - 06-20-2017, 02:00 AM
RE: 404 Override Not Working - by Martin7483 - 06-20-2017, 02:00 AM
RE: 404 Override Not Working - by wolfgang1983 - 06-20-2017, 02:03 AM
RE: 404 Override Not Working - by reactionstudio - 06-20-2017, 02:05 AM
RE: 404 Override Not Working - by wolfgang1983 - 06-20-2017, 02:12 AM
RE: 404 Override Not Working - by Martin7483 - 06-20-2017, 02:21 AM
RE: 404 Override Not Working - by reactionstudio - 06-20-2017, 02:37 AM
RE: 404 Override Not Working - by Martin7483 - 06-20-2017, 02:10 AM
RE: 404 Override Not Working - by Martin7483 - 06-20-2017, 02:54 AM
RE: 404 Override Not Working - by reactionstudio - 06-20-2017, 03:26 AM
RE: 404 Override Not Working - by Martin7483 - 06-20-2017, 04:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB