Mobile app version of vmapp.org
Login or Join
Bethany197

: Preventing Cache for Text Content but not for CSS files and Images I have Wordpress blog that I write blog posts about javascript. I update the same post by generally 12-13 days or so. But

@Bethany197

Posted in: #Cache #Wordpress

I have Wordpress blog that I write blog posts about javascript. I update the same post by generally 12-13 days or so. But sometimes I push updates daily.

After I update my article and publish to changes, I go to the article page with Firefox but I see the cached page rather than the updated one. Here is an example post url.
example.com/?p=1111
This is my response header for the same page if it is first time viewed.



After it is viewed first time, if I click in location bar of Firefox and press Return, the page is loaded from cache. Request header is below. Because it is loaded completely from cache it does not have Response Header.



It seems clear the Cache-Control might be the main issue but I do only want to prevent page (HTML) cache but not the style and image files. I already have WP-Cache plugin to cache files and I use CDN to serve site images.

In this context, I find Firefox useful to load CSS, Javascript and Image files from cache but I do not want Firefox to cache page text context. To get the latest version of my page content, I have to use CTRL + SHIFT + R to force reload the page but this time all CSS, Javascript and image files are also downloaded from server unnecessarily.

Is it possible to download page content always from server but load CSS, Javascript and Image file from cache?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Bethany197

1 Comments

Sorted by latest first Latest Oldest Best

 

@Eichhorn148

You can set up apache to set the "expires" header by the type of content. This functionality requires two modules be enabled:

LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so


Then you can configure different expires times for you html content compared to all your content:

ExpiresActive On
ExpiresDefault "access plus 5 days"
ExpiresByType text/html "access plus 1 seconds"


Here is the documentation for mod_expires.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme