Getting Started

ID #74

Why do I keep getting old copies of my pages when I just updated and changed my files?

Applies to: Grid System

If you know you are behind a caching proxy, click here.

Assuming you have uploaded your web files to the right directory, try setting your browser to always get a new copy of every page. In Internet Explorer, do this by choosing Tools, Options, Settings, and select "Every visit to the page", then OK. In Netscape it is Edit, Preferences, doubleclick Advanced, click Cache, and then select "Every Time", then OK.

Also try clearing your browser cache. In Internet Explorer, do this by choosing Tools, Options, click Delete Files, check delete all offline content, then OK. In Netscape it is Edit, Preferences, doubleclick Advanced, click Cache, and then click "Clear Memory Cache" and "Clear Disk Cache", then OK.

Then hit the Reload or Refresh button on your browser to try to get a new copy of the page. If you still get the same stale copy, you are probably experiencing a "cache-box" put in place by your Internet Service Provider. ISPs use such devices in order to save bandwidth and make pages load faster for their subscribers.

If your ISP is using a cache-box or proxy server, then when you request a webpage, the cache-box at your ISP first checks to see if it has a cached or stored copy of the page you are requesting. If it has one, then it just gives you that one without going out on the internet to download a fresh copy from the remote site. If it doesn't have the page already, then it will go out to the internet, download a fresh copy, give it to you, and then cache that copy for the next person who asks for the same webpage.

The way a cache-box determines whether to "cache" a page or download a new one is determined by the page's headers, either http or html.

If you put the following PHP code at the top of a file that should not be cached, cache-boxes should not cache it and people will be able to get fresh copies of the page every time they request it:

header("Expires: Mon, 26 Jul 1990 05:00:00 GMT");

 

header("Last-Modified: " . gmdate("D, d M Y H:i:s", time() + 300) . " GMT");

 

header("Cache-Control: no-cache, must-revalidate");

 

header("Pragma: no-cache");


?>

You might also be able to prevent the cache-box from saving your page and subsequently feeding you or your visitors stale copies of it by using these html meta tags:





Use of http headers is probably more effective than using html meta tags.

Finally, if you implement one or both of these methods only AFTER a proxy server has already cached your page and is already causing you problems, then you have only prevented future proxy caching problems. Implementing the methods above will not cause a cache-box that has already cached your site to request a fresh copy with the new no-cache headers. In such case, you may want to call your ISP and ask them to clear their cache of your site.


Last update: 2010-09-29 16:50
Author: FAQ Admin
Revision: 1.2

Digg it! Share on Facebook Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 3 (3 Votes)

completely useless 1 2 3 4 5 most valuable

You can comment this FAQ

Comment of Anonymous:
After upload your files you can press CTRL +F5 or SHIFT+RELOAD to get a fresh copy!
Added at: 2004-12-05 03:15