Welcome Guest, Not a member yet? Register   Sign In
Custom 404 page working in localhost, but not in live site..
#1

Hello,
I have the following problem.. 
I've created a custom 404 page controller and overrided it with routes file. 

But the thing is that in my localhost site this custom 404 page working fine, but in live site, the 404 error page is loaded over "application/views/errors/html/error_404.php" and not from the custom view file with header, footer etc..

Any ideas on what's going on?

Here are routes, controller files etc...

Routes:
Code:
$route['404_override'] = 'c404';

"c404" Controller:
Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class c404 extends MY_Controller {
  public function __construct(){
    parent::__construct();
  }
 public function index(){
   $this->output->set_status_header('404');
   $data['title'] = 'Page not found!';
   $this->render_page('404', $data);
 }

}


My_controller file:
Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class MY_Controller extends CI_Controller {
 protected function render_page($view, $data) {
   $data['site'] = $this->page_model->get_info();

   $this->load->view('templates/header', $data);
   $this->load->view($view, $data);
   $this->load->view('templates/footer', $data);
 }

}


Thanks!

//Life motto
if (sad() == true) {
     sad().stop();
     develop();
}
Reply
#2

The code looks correct to me, so I am inclined to say it isn't the code you shared. One idea, are there differences in the web servers between your local and the live site?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB