3

I am new in code igniter.I created a login form and a logout section. When i press the logout section, the page will redirect to login section. And when i click the back button in the browser it will show the previous pages.When i click the clear recent history and the choose cache,and then press the back button, it will not show the recent pages.It only shows the login section. How to overcome this?Please help me...

3 Answers 3

4

In the .htaccess file please add the lines:

<IfModule mod_headers.c>
Header add Cache-Control:  "no-store, no-cache, must-revalidate"
</IfModule>

this .htaccess file should be out side of the application folder. So if you logout your site i.e. if you destroy all the session then no data be stored in the store. So by clicking the back button in the

Sign up to request clarification or add additional context in comments.

Comments

2
$this->output->set_header('Pragma: no-cache');
$this->output->set_header('Cache-Control: no-cache, must-revalidate');
$this->output->set_header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');

Comments

1

header()

I would add this

header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past

to the beginning of pages where the user is logged in.

2 Comments

Still it contains same issue.My login page login_page.php.Aftter logging in i have set the session and then redirect to index.php page.I placed your code in both the files. But it didn't get work.
Hi, I got a solution for it....Add the following statement to every controller constructor,except the login page constructor. ........ $this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0"); $this->output->set_header("Pragma: no-cache");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.