Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Your Answer


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

Browse other questions tagged or ask your own question.