Site is showing cached contents !!?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mashhoor

    #1

    Site is showing cached contents !!?

    My site is suffering from a serious problem.

    Whenever i update something on it , the visitors need to "refresh" in order to see the changes. And what makes it worse that it occasionally show the old version of a certian html page(s) wich breaks the design and makes it look horrible since it relies on a modified CSS style.

    I've used those meta tags on each html file but they were useless :
    Code:
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="-1" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    How do i stop my site from viewing chached pages? I update the site few times a day and visitors think that its still not updated. (someone even told me that he couldn't see the new layout even when he refreshed the page ).


    your help is much appreciated
  • sdjl
    Senior Member
    • Mar 2004
    • 502

    #2
    That sounds likea problem with your users setup, not your website.
    If you have the correct headers in place to tell the browser to refresh, it should obey those requests.
    However, this is the world of IE and it's lovely random manipulation and interprutation of webpages.

    There is a PHP header that you could try outputting at the top of every page to force a refresh.
    This is the code from the manual:
    PHP Code:
    <?php
    // Date in the past
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

    // always modified
    header("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT");

    // 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");
    ?>
    Remember, if you do use this code, this needs to go before any other HTML output. This includes whitespaces and such.
    Give it a try maybe on one page that changes frequently and see if your visitors are getting the update.

    David
    -----
    Do you fear the obsolescence of the metanarrative apparatus of legitimation?

    Comment

    Working...