Chris G.
Chris G.

Reputation: 3981

Changing default route after a user is logged in

How do I change the default route after a user is logged in? I'm using the CodeIgniter framework.

Upvotes: 0

Views: 91

Answers (2)

b3n
b3n

Reputation: 1324

You can change the default route with

$route['default_controller'] = 'route'; 

in application/config/routes.php

Upvotes: 0

Matthew
Matthew

Reputation: 15652

Rather than changing the default route, you could simply have your controller act differently if they are logged in. Something like:

class Welcome extends CI_Controller {
  public function index()
  {
    if($logged_in) {
      $this->load->view('authenticated');
    } else {
      $this->load->view('guest');
    }
  }
}

Upvotes: 2

Related Questions