Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Currently my website has cache controls set for javascript libraries and images, and caches them for one week. I'd like to know what best practices I should following leading up to my websites relaunch in a week. All images, javascript, css files will be replaced.

A couple of strategies I'm considering:

  1. Change the ExpiresByType to one hour for the next week, to ensure returning visitors wont have slower speeds, and then 1.5 hrs before launch, change the cache control to zero.

  2. Change the ExpiresByType to zero until launch.

  3. Remove all cache controls from the htaccess until launch, and let the browsers handle caching.

Any thoughts on the above strategies or things I haven't considered? Thanks

This is my root .htaccess. Applies to images and javasript libraries:

ExpiresActive on
ExpiresByType image/jpg "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType application/x-javascript "access plus 1 week"
ExpiresByType application/javascript "access plus 1 week"

This resides in another sub-directory from the root. Overides the above controls and resets to zero for my custom javascript files

ExpiresActive on
ExpiresByType text/javascript "access plus 0 seconds"
ExpiresByType application/x-javascript "access plus 0 seconds"
ExpiresByType application/javascript "access plus 0 seconds"
share|improve this question

cache and server(s) location of assets is delivery speed - decentralize assets and use cloud related cache will allow for near simultaneous requests as the requests are fed by multiple sites.

IMHO, Centralizing assets on a single server is a failed concept.

share|improve this answer
If your concern is cache policies, consider a map related to need for updates. example taxonomy: Logos, trademarks, corporate identity are rarely undated. Other images are frequently changed requiring a cache refresh of only these assets. – Testbench Feb 18 '15 at 21:10

Your Answer


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.