0

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().

Anoop S
  • 141
  • 1
  • 12

1 Answers1

0

Try this with slash:

 redirect('/admin/dashboard')
  • 1
    I am not pro in codeigniter but this could help you: http://stackoverflow.com/questions/11792268/how-to-set-proper-codeigniter-base-url –  Nov 16 '16 at 18:14