Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to disable page caching for certain pages

Posted on 2007-12-05
1
Medium Priority
?
1,376 Views
Last Modified: 2008-02-01
Hi everybody,

I need to disable some pages from caching either via php or jscript. To be exact, I need certain pages to be reloaded when accessed by clicking a back button. I know a way of doing this via php (not sure it is the best one) - see the code attached.

Any other or better solutions?

Thanks
A
<?    
header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );
?>

Open in new window

0
Comment
Question by:andy7789
1 Comment
 
LVL 4

Accepted Solution

by:
simonkin earned 2000 total points
ID: 20410603
Hi, try adding this to the headers you have in place already...
<?php
 
header( "Cache-Control", "post-check=0, pre-check=0" );
 
?>

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question