Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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.

http://example.com/?p=1111

This is my response header for the same page if it is first time viewed.

Response Header

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.

Request 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?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.