Cache Busting in RW

I have a WordPress client that we added a cache busting plugin, it works from time to time, but not 100% with everyone in their office.

They are now asking if I can put together a sample home page with cache busting in RW to see if this fixes it. They are continually asking how larger sites (Best Buy and Amazon (their examples) are handling this.

I have been using the RW “Generate Cache-Busting Links” in RW8, but every once in a while, a customer will tell me they are not seeing the latest updates. It happens for me on occasion as well with a website we update every week. It’s been much better since the RW “Generate Cache-Busting Links” was added to RW.

How do I ensure that cache-busting is 100%? Is that even possible? Is this tied to hosting at all @barchard? I know this particular client is using SiteGround with his WP site. I contacted SiteGround and they said with WP they use a server side cache that we have to empty out.

I figured before I sent out my RW example home page, I would make sure I covered all my bases and give them the most accurate information that I can.

The Cache busting links in RapidWeaver only affect the Support files like CSS and Javascript. RW simply adds a query string to the file name. That makes sure that the CSS and JS get refreshed along with the main content(HTML, PHP).

If you want the browser to “re-read” the main pages you need to do this with changes to the HTTP header.

something like this in the htaccess file would work:

# BEGIN Caching
<ifModule mod_headers.c>
<filesMatch "\\.(html|htm|php)$">
Header set Cache-Control "max-age=1, private, must-revalidate"

That would tell the browsers that a .html or .php files can only be cached for 1 second.

1 Like


yes what @teefers said should help. you could try throwing a query string in the URL like ?no-cache=1 and see if that’ll get the browser to clear itself for them. This may help isolate the issue. Clearing the browser cache should also work.

Large companies use expiration policies so the asset is ‘short-lived’ (or long, depending on your application’s needs). That will force the browser to grab the latest copy from the server

Hope that helps.


1 Like

@teefers and @barchard Thank you guys. This is very helpful.

This did not fix it. I went ahead and added to this site: I change the ad every week and thought this would be a good place to test. Added the code to my htaccess file and nothing happened.

I then tried this in my head and nothing, still loads last weeks page for me.
meta http-equiv=“Cache-Control” content=“no-cache” />
meta http-equiv=“Pragma” content=“no-cache” />
meta http-equiv=“Expires” content=“0” />

Any other ideas? I’ve scoured through Google looking for something different to try.

What exactly do you change?

The htaccess code I gave you above looks like it is being applied to the header and the Cache status is coming back EXPIRED. The HTML file is NOT being loaded from memory. Here is the http response from the URL above:


  • If what you change is not within this file (like CMS or JS), then you need to expire those files.
  • Make sure if you are using something like CloudFlare you refresh there as well.
  • I find it best practice to not rely on adding header data via HTML meta tags http-equiv, although it works it only gets applied to the HTML file, and if you have header data on the server (htaccess or other server config file) it will override the meta tags directives.
1 Like

I change the ad (jpg) every week on this site.

Does the filename change? Images will (as they should) get cached unless you specifically not cache them.

I don’t see the screenshot above on the URL you gave.
This is what I see:

The file name doesn’t change, I just drop in a new image every week. The ad you’re seeing is this week’s ad. I can see the change in the date, but the jpg stays the same as last week.

I also added jpg and png to the htaccess file you gave.


That’s why it’s being read from cache. You want jpegs to be cached, otherwise your site would become slow.
You might consider changing the file name every week. If that’s impractical then you could setup a cache directive for that single file.

How would I go about setting up a cache directive for that single file?

img src=“files/image_stack_img_487313.jpg”

How were you able to see the “Response”?


That’s from the network area of either Safari’s web inspector, or Microsoft Edge developers tools (I don’t remember what one I used, all browsers have tools). It looks like Safari I’m not at a Mac right now, but under network you can display header data.

As for setting up a single file cache, I can give you the code, but I’m on my iPad and probably won’t be back to a desktop till Friday.

This is totally untested and should set the expiry to 3600 seconds(1 hour) for the single file. That’s if I’ve got the syntax right.

<FilesMatch "files/image_stack_img_487313\\.jpg$">
    Header set Cache-Control "max-age= 3600, private, must-revalidate"

Try placing the code between the
</filesMatch> and </ifModule> at the bottom of what i gave you above.

1 Like

Thank you, that seems to work. I’ll set up another project and run some test later this week. I appreciate the help.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.