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 Cod开发者_JS百科eIgniter framework.
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');
}
}
}
You can change the default route with
$route['default_controller'] = 'route';
in application/config/routes.php
精彩评论