I'm trying to make sure that my visitors do not get a cached version of the pages on my site, but I can't seem to make IE serve up the fresh version. I've tried these: <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> Doesn't work. I also have another related questoin - does putting the no-cache meta tag in the page also affect the cache in Google?
Have you tried setting the expired tag to be always in the past? <META HTTP-EQUIV="Expires" CONTENT="Mon, 06 Jan 1990 00:00:01 GMT">
You can add these lines to the .htaccess, for example. <Files *> Header set Cache-Control: "private, pre-check=0, post-check=0, max-age=0" Header set Expires: 0 Header set Pragma: no-cache </Files> Code (markup):
I still don't know what to do with that. What is htaccess?? I hate to keep asking questions, but you are assuming me to have more knowledge than I have. I really hope this works once I figure out how to do it, since I'm tired of getting emails from people asking me why the pages haven't changed when they were supposed to. I just keep responding, "Refresh!"
Sorry.... The .htaccess file is a configuration file "per-dir" of Apache. In other words: just create a .htaccess file, copy the above code I've posted, and then upload the file to the server. (If you are using windows, check if the name of the file isn't .htaccess.txt!) If you have any more questions just ask!
That all reads like Greek to me. Per-dir of Apache?? How do I create an htaccess file and which directory should it be uploaded to?
a .htacces file is a simple text file, but named ".htaccess" (without quotes). Per-dir means that the apache configuration options can be different in each dir. You should have the .htaccess file in the main folder of your site, maybe "htdocs"?
you can do it with server side scripting too, for instance, PHP: <?php // HTTP/1.1 header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); // HTTP/1.0 header("Pragma: no-cache"); ?> PHP:
In an .htaccess file, you can even control by different cache settings for different types of files: ExpiresActive On ExpiresDefault "modification plus 1 day" ExpiresByType image/gif "modification plus 1 month" ExpiresByType image/jpg "modification plus 1 month" ExpiresByType image/x-ico "modification plus 1 month" That, I believe (I'm not an expert, and don't even play one on TV), would set the default cache info sent out as refresh if over 24 hours since file date/time, but for the selected graphics would instead use "if over 1 month", which is useful for sites with images that rarely if ever change--your "real" pages get refreshed as often as you want to demand, but you don't require frequent (time- and bandwidth-wasting) freshening of stable files.