Welcome Guest, Not a member yet? Register   Sign In
Routes and Controller basic
#1

[eluser]Unknown[/eluser]
I have my routes.php as

Code:
$route['home'] = 'pages/home';
$route['login'] = 'pages/login';
$route['default_controller'] = 'pages/home';

and the controller pages.php as

Code:
class Pages extends CI_Controller {

    public function home() {
        $this->load->view('templates/header');
        $this->load->view('pages/home');
        $this->load->view('templates/one');
        $this->load->view('templates/two');
        $this->load->view('templates/footer');
        }

    public function login() {
        $this->load->view('templates/header');
        $this->load->view('templates/login');
        $this->load->view('templates/footer');
        }
    }

Pre: I have just started with CodeIgniter and what I got from basic tutorial, as per the the routing rule $route['login'] = 'pages/login' , a call for domain/login will be routed to Pages->login()

The Problem: I don't understand why these simple url re-routing domain/login or domain/home show a 404 error.
#2

[eluser]Zack K.[/eluser]
What does your file structure look like?




Theme © iAndrew 2016 - Forum software by © MyBB