I'm working on a Codeigniter project and I want to show a custom 404 page if a route not found. everything is working fine on localhost but when I upload my project on live server it's not showing anymore. On live server it shows me default 404. and the url is generate like this example.com/my404 but not show my custom 404. Please help me to find out where I missing something. Thanks for you valuable answer.
Here is my view file error_404.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>404 Page Not Found</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<style type="text/css">
body
{
padding: 0px;
margin:0px;
}
h1
{
padding: 0px;
margin: 0px;
font-size: 15px;
text-align: center;
font-weight: 600;
font-family: sans-serif;
color: #003a99;
}
#container
{
width: 100%;
background-position: top center;
background-repeat: no-repeat;
background-attachment: local;
background-size: cover;
}
.web
{
padding-top: 10px;
padding-bottom: 85px;
}
span
{
color:#333;
}
.heading
{
color:#333;
}
</style>
</head>
<body>
<div id="container" class="img-responsive" style="assets/images/background-image:url(404-Page-Not-Found2.jpg);">
<img src="assets/images/404-page.png" class="img-responsive"/>
<h1 class="heading">The page you’re looking for went fishing!</h1>
<h1 class="web">Go back to <a href="<?php echo base_url();?>"><span>www.vpacknmove.in</span></a><h1>
</div>
</body>
</html>
Here is my Controller file My404.php
<?php
class My404 extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->output->set_status_header('404');
$this->load->view('error_404');//loading in my template
}
}
?>
And my routes
$route['404_override'] = 'My404';
$route['default_controller'] = 'Home';