Reputation: 1193
I am using codeIgniter 2.1.4
in my application. If am in a page that require authentication. Then I logout after logout if I use browser back button it will get me back to the secured page. I can only view the page. If I refresh or click on any link it will redirect me to the login page.
I think it's a cache issue? But I am not sure.
Upvotes: 1
Views: 3790
Reputation: 800
paste $this->output->nocache();
in your __construct()
function after parent::__construct();
Upvotes: 2
Reputation: 1425
You can prevent the client's browser from caching the site by adding
<meta Http-Equiv="Cache-Control" Content="no-cache">
<meta Http-Equiv="Pragma" Content="no-cache">
<meta Http-Equiv="Expires" Content="0">
into your HTML header.
Upvotes: 0
Reputation: 8168
Include these headers in the constructor function of the controller to prevent the caching of previous page
If you want the Code Igniter's way of doing it include the below code
$this->output->set_header('Last-Modified:'.gmdate('D, d M Y H:i:s').'GMT');
$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');
PHP's way of doing it use the below lines of code
header("cache-Control: no-store, no-cache, must-revalidate");
header("cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
Upvotes: 1