Below given is the index()
of my Admin controller (only admin should access this section):
public function index() {
$this->load->helper('url');
$user = $this->session->user;
if (!$user)
$this->load->view('admin\login_form');
else
redirect('admin/dashboard'); // I tried redirect('dashboard'); too
}
If the user is logged in, it redirects to localhost/store/localhost/store/index.php/dashboard
. i.e., it appends the whole url after my base url (which is localhost/store
). I also tried 'refresh'
as the second parameter in redirect()
.