I'm using codeigniter 3 and ion_auth for authentication.
I'm trying to get a method in my controller to redirect to another method if not logged in, other than the auth/login page, but whatever i try, it still redirects to the auth/login page???
So for testing purposes, with this method, im trying to get it to redirect to a different method in the same controller 'new_index', but it still redirects to auth/login.
Why is this?
public function index() {
// redirect if not logged in
if (!$this->ion_auth->logged_in()) {
// redirect them to the login page
redirect('new_index');
}
else {
$view_data = array(
'page_title' => 'Training Dashboard'
);
$this->load->view('training/training_dashboard',$view_data);
}
}
public function new_index(){
echo "Hello";
}
I don't get where the instruction to redirect to auth/login is coming from?
您是否在配置中配置了Base Url。如果没有,请将其设置为指向项目目录
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.