1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

No-Cache

Discussion in 'HTML & Website Design' started by Chiara, Jun 4, 2004.

  1. #1
    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?
     
    Chiara, Jun 4, 2004 IP
  2. Help Desk

    Help Desk Well-Known Member

    Messages:
    1,365
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    180
    #2
    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">
     
    Help Desk, Jun 4, 2004 IP
  3. Chiara

    Chiara Peon

    Messages:
    330
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I just tried it and it doesn't work. :mad:
     
    Chiara, Jun 4, 2004 IP
  4. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You need to print those tags as http headers instead of using <meta> tags.
     
    nlopes, Jun 5, 2004 IP
  5. Chiara

    Chiara Peon

    Messages:
    330
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #5
    How do I do that?
     
    Chiara, Jun 5, 2004 IP
  6. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    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):
     
    nlopes, Jun 6, 2004 IP
  7. disgust

    disgust Guest

    Messages:
    2,417
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    0
    #7
    this was pretty useful, thanks :)
     
    disgust, Jun 6, 2004 IP
  8. Chiara

    Chiara Peon

    Messages:
    330
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #8
    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!" :)
     
    Chiara, Jun 7, 2004 IP
  9. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    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! :)
     
    nlopes, Jun 7, 2004 IP
  10. Chiara

    Chiara Peon

    Messages:
    330
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #10
    That all reads like Greek to me. :)
    Per-dir of Apache?? :confused:
    How do I create an htaccess file and which directory should it be uploaded to? :eek:
     
    Chiara, Jun 7, 2004 IP
  11. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    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"?
     
    nlopes, Jun 7, 2004 IP
  12. Chiara

    Chiara Peon

    Messages:
    330
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #12
    I found the htaccess file and added the code you gave me at the end - is that right?
     
    Chiara, Jun 7, 2004 IP
  13. vinyl

    vinyl Well-Known Member

    Messages:
    302
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    165
    #13
    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:
     
    vinyl, Jun 7, 2004 IP
  14. Owlcroft

    Owlcroft Peon

    Messages:
    645
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #14
    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.
     
    Owlcroft, Jun 7, 2004 IP
  15. North Carolina SEO

    North Carolina SEO Well-Known Member

    Messages:
    1,327
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    105
    #15
    Thanks for the info!
     
    North Carolina SEO, Jun 7, 2004 IP
  16. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #16
    yes! You may add those lines to the begining or to the end of the file.
     
    nlopes, Jun 8, 2004 IP
  17. fotograf

    fotograf Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    This is what I was looking for. Thank you.
     
    fotograf, Sep 27, 2011 IP