Skip to main content

CodeIgniter Redirect to Current Page URL After Logout ?

In CodeIgniter you can get current page URL using CodeIgniter URL helper function current_url().

Now you knew how to get current page url, then append the current page url to logout url, here is the code


 echo anchor('auth/logout','logout/'.base64_encode(current_url()));
now in your logout method should be something like this :


public function logout($url){
    redirect(base64_decode($url));
}
I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.