Question

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...

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top