donnikitos
donnikitos

Reputation: 976

Cache everything but HTML page (partial caching)

Right now I am using a mix of HTTP headers and meta tags to disable the caching of my whole page. For slow connections it's just a nightmare.

Now my question:
Is it possible to partially disable caching? E.g. I would like to disable caching for the HTML page, but still cache all scripts, stylesheets, images, etc...

Upvotes: 0

Views: 207

Answers (1)

Nisse Engström
Nisse Engström

Reputation: 4752

Yes.

Leave scripts, stylesheets and images as static files and let the webserver handle them. The server will make them cacheable by default, unless you go out of your way to configure it otherwise.

Use PHP or similar to add the appropriate HTTP headers to your HTML page.

If your HTML page is a static file, check out mod_headers.

Upvotes: 1

Related Questions