How can I redirect to current url after logout?
HTLM for logout:
<a href="<?php echo base_url() ?>korisnik/logout">Logout</a>
Controller function:
function logout() {
$this->session->sess_destroy();
redirect(base_url());
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
yAnTar has the right idea (storing the last url in the current one), but CI urls don’t normally accept all characters in a base64 encoded string (like
=). Try this:Another option could be to redirect to
$this->input->server('HTTP_REFERER'), but I’ve had issues with that in the past (old version of Google Chrome sendingfavicon.ico) and don’t normally recommend it.