Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error 404 on logout function (Ion Auth) using Codeigniter

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/';
like image 929
Jose Avatar asked May 16 '26 06:05

Jose


1 Answers

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

like image 162
Bikram Pahi Avatar answered May 18 '26 22:05

Bikram Pahi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!