yimy
yimy

Reputation: 73

CodeIgniter Error opening Home Page

I create a Home Page and when I want to access it's written Page Not Founded I create in my rount.php access but again there is same error

$route['pages/index']= 'pages/home';

Do I need to change my controller or model or just route.php file

Pages controller

<?php

class Pages extends CI_Controller{

    public function index(){

        $this->load->view('pages/home');
    }

    public function view($page='home'){
        if(!file_exists(APPPATH. 'views/pages/'.$page.'.php')){
            show_404();
        }

        $data['title']= ucfirst($page);


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

Upvotes: 0

Views: 81

Answers (1)

Amit Chauhan
Amit Chauhan

Reputation: 682

try like this . and make sure you are linking right base_url for home index function like this. follow this if its help .

echo base_url("pages/home");

$route['pages/home']= 'pages/index';

Upvotes: 2

Related Questions