Viewed   128 times

After I logout from my app, when I press the back button, all of the login options for the user is still showed on the page.

After I login, when I press the back button it will show the logout version of the page.

I tried setting this in my logout controller

function logout() {
    $this->output->set_header('cache-Control: no-store, no-cache, must-revalidate');
    $this->output->set_header("cache-Control: post-check=0, pre-check=0", false);
    $this->output->set_header("Pragma: no-cache");
    $this->output->set_header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
    redirect(subdomain() . 'home');

But the cache is still there when i press the back button. How can i fix this?


I think caching is not the problem here, I disabled caching in chrome in developer settings but my browser is still going to the secured page after logout when i press the back button.

So caching is not the problem..



Hello sorry for saying that caching is not the problem. Caching is the problem! I fixed this by putting this code in the index.php file of the codeigniter.

header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
Sunday, October 23, 2022

This was driving me crazy for hours but the solution (as usual) was simple. I had forgotten to make sure


was the same for both applications!

Working great now

Wednesday, August 3, 2022

Edit your user_agent.php in /config, and add the bots you see in your session, adding them to the bot section should eliminate the sessions from logging.

// There are hundreds of bots but these are the most common.
$robots = array(
    'googlebot'     => 'Googlebot',
    'msnbot'        => 'MSNBot',
    'baiduspider'   => 'Baiduspider',
    'bingbot'       => 'Bing',
    'slurp'         => 'Inktomi Slurp',
    'yahoo'         => 'Yahoo',
    'askjeeves'     => 'AskJeeves',
    'fastcrawler'   => 'FastCrawler',
    'infoseek'      => 'InfoSeek Robot 1.0',
    'lycos'         => 'Lycos',
    'yandex'        => 'YandexBot'

You can reduce the # of bots, but won't eliminate them. This user-agent process could be used to create a MY_session.php and then exclude session creation for agents matching bots.

I went ahead and created this on github and documented here:


Monday, December 5, 2022

Hi there check the wp_logout_url($redirect_url).

Monday, November 28, 2022

You want onPause(), not onStop(). onStop is called just before the activity is destoryed, when the system is low on memory. onPause is called whenever the user navigates away from your activity. See diagram at

Thursday, September 1, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :