3

Calling this function to redirect me to the login webpage throw me '404 Error : the page you requested was not found'. I have followed the same steps that i followed for another application and it worked fine. Any Ideas?

Link

<li>
                            <a href="<?= base_url('auth/logout') ?>">Salir</a>
                        </li>

Ion Auth function

// log the user out
public function logout() {
    $this->data['title'] = "Logout";

    // log the user out
    $logout = $this->ion_auth->logout();

    // redirect them to the login page
    $this->session->set_flashdata('message', $this->ion_auth->messages());
    redirect('auth/login', 'refresh');
}

Base_url

$config['base_url'] = 'http://localhost/herba/';
Jose
  • 310
  • 1
  • 12

2 Answers2

1

Change this

public function logout() {
    $this->data['title'] = "Logout";

    // log the user out
    $logout = $this->ion_auth->logout();

    // redirect them to the login page
    $this->session->set_flashdata('message', $this->ion_auth->messages());
    redirect(base_url('auth/login'), 'refresh');
}

please make sure http://localhost/herba/auth/login exist

Also check with index.php

http://localhost/herba/index.php/auth/login

Bikram Pahi
  • 1,107
  • 1
  • 12
  • 33
  • Thanks! It worked with 'http://localhost/herba/index.php/auth/login' but i don't understand, it should work with 'http://localhost/herba/auth/login' as my old proyect. Why is this happening? – Jose Apr 26 '17 at 11:09
  • please check your `.htaccess` file. I think the issue is there. – Bikram Pahi Apr 26 '17 at 11:23
  • Where is the issue? `RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.php|assets) RewriteRule ^(.*)$ ./index.php?$1 [L]` – Jose Apr 26 '17 at 11:29
0

Do you have mod_rewrite enabled and allow_override for this project in your apache settings?

Ben Edmunds
  • 888
  • 4
  • 6
  • I am using xampp and i did the following: http://www.leonardaustin.com/blog/technical/enable-mod_rewrite-in-xampp/ but it doesn't work – Jose Apr 27 '17 at 06:12