OK, Web Developing Gurus ~ Is there a way that I can force a cache override (7 posts)

  • As a golf course, our prices change regularly, depending on the time of year.  I try to keep prices all on one page to avoid people having to bookmark different pages (ie:  Winter Prices, Spring Prices, etc).

    However, last year after we went to Spring pricing, I had customers come in mad because they’d pulled the page up and saw Winter pricing.  I knew what was going on . . . CACHED PAGES!

    Is there a piece of code that will force a fresh load on a page?

  • @dedimaso

    Can you share what environment your working in? Is your site static html, built using wordpress or some other software? And can you share a link to the site?

    Cheers!
    Jules

  • You could use a bit of code in your page header like:

    <META HTTP-EQUIV=”CACHE-CONTROL” CONTENT=”NO-CACHE”>
    or
    <META HTTP-EQUIV=”REFRESH” 
    CONTENT=”15;URL=http://www.yoursite.com/thepricingpage.html”>
    Google these for more information, but they both should work.

  • @dedimason SME user @michaelraia shows you 2 ways to update your pricing content to make sure its not cached.

    Also, I strongly suggest that you put a header and disclaimer on your pricing content. 

    A header saying “Winter 2011-2012 Pricing” then you can update it later to say “Spring 2012 Pricing”

    Then a disclaimer like prices subject to change by season.

    If you have a dynamic website, you’ll need to see if your server is caching the content as well. Do you know if this is true?

  • @juleswebb ~ The sites are static HTML.

    @michaelraia ~ Thank you!

    @robmitchell ~ The header has always changed with the price changes but when I read what you wrote, I realized that I could add a line that says “Good Through [DATE], refresh page if you’re seeing this after [DATE].

    I have a dynamic DNS if that’s what you’re asking.  I’ll have to check to see if the server caches pages.  I do know that I keep my own cache cleaned daily and when I update the pages, I have no trouble with old pages showing on my computer.

    Thanks so much everyone!  :)

  • @dedimason 
    You can’t always rely on  meta tags in an HTML page for controlling caching. (sorry to disagree with you  @michaelraia  –if you have supporting documentation I would be happy to learn and recant if I’m incorrect.)

    Assuming that your site is hosted on a server that’s running the Apache Web Server software (contact your hosting provider to find out) I would add the following to your .htaccess file

    Sorry, The code didn’t present well when I saved the comment so I’m linking to a text file instead: 
    Expires Headers

    It’s a little above and beyond what you need, but it will do the job.  This is the same code I use in my site.

    Here are some reference links.http://www.askapache.com/optimize/speed-site-caching-cache-control.htmlhttp://www.htaccess-guide.com/

    Cheers!
    Jules

  • @juleswebb ~ thanks for that info!  Yes, I’m pretty sure the host is using the Apache Web Server software.  I’ll double check, since I just switched hosts.


Add your voice to the discussion

Existing members: . If you do not have a SME account, .