Current time: 04-23-2014, 12:32 PM Hello There, Guest! (LoginRegister)

Post Reply 
Updating Website
05-09-2008, 09:05 AM
Post: #1
Updating Website
How can I ensure that my visitors are viewing the most up date version of my site?
Find all posts by this user
Quote this message in a reply
05-09-2008, 09:48 AM
Post: #2
Updating Website
Quote:How can I ensure that my visitors are viewing the most up date version of my site?
I assume you are referring to issues involved with page caching. There are a couple of meta elements you can add to the <head> of your documents that can indicate caching is undesirable, but these aren't necessarily supported by all browsers:
Code:
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
The latter meta element is really for older browsers. A more robust method is to use HTTP headers to deal with this. For maximum redundancy, set the headers like this:
Code:
Cache-Control: no-cache
Pragma: no-cache
If you are using PHP, you can set headers by placing statements at the top of your document like these:
Code:
<?php
header("Cache-Control: no-cache");
header("Pragma: no-cache");
?>
-- si-blog --
Max discount on any plan with promocode SCJESSEYTOTAL
Visit this user's website Find all posts by this user
Quote this message in a reply
05-09-2008, 11:14 AM
Post: #3
Updating Website
Thanks so much for your response!

the HTTP header method sounds more like what I'm looking for..

Would it be possible to explain how to go about this in more detail?

Thanks
Find all posts by this user
Quote this message in a reply
05-09-2008, 01:21 PM
Post: #4
Updating Website
Assuming your Apache installation is running the mod_headers Apache module (and I think most are), you can set the headers in your .htaccess file like this:
Code:
Header set Cache-Control "max-age=0, no-store"
Ignore the "pragma" thing I mentioned earlier - it shouldn't be needed on the DreamHost setup and it would essentially create an invalid server response. If you want to restrict this behavior to a specific file or group of files, you could do something like this:
Code:
<Files index.html>
Header set Cache-Control "max-age=0, no-store"
</Files>
Or this:
Code:
<Directory "/home/username/domain/path/to/folder-you-don't-want-cached">
Header set Cache-Control "max-age=0, no-store"
</Directory>
-- si-blog --
Max discount on any plan with promocode SCJESSEYTOTAL
Visit this user's website Find all posts by this user
Quote this message in a reply
05-09-2008, 02:33 PM
Post: #5
Updating Website
Sweet! I'll let you know how it goes. Thanks again.
Find all posts by this user
Quote this message in a reply
05-09-2008, 03:05 PM
Post: #6
Updating Website
Used the first htaccess setting and everything seems to be working as planned!

THANKS SO MUCH!.
Find all posts by this user
Quote this message in a reply
05-09-2008, 11:28 PM
Post: #7
Updating Website
I did not know this. Apache is so sweet!

$50 off and 3 free domains with code: DH3 Sign Up NOW or More Codes Here
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: