By default, our servers do not set any Expires headers on any files. However, setting an Expires header can dramatically improve the performance of your web site because it allows the Client browser to avoid re-downloading a fresh copy of an image for every visit to your site. For example, if you set an Expires header for a week from the file access time, then the client browser software of all your visitors can store that image locally for a week, and continue to use it without consulting the web server again until it expires. We strongly recommend using this feature for images and media files that you know will not change frequently.
Here are the contents of an .htaccess file that sets expiration for 7 days for various media files:
ExpiresActive on ExpiresByType image/jpeg A604800 ExpiresByType image/gif A604800 ExpiresByType image/png A604800 ExpiresByType application/x-shockwave-flash A604800 ExpiresByType audio/mpeg A604800
Note that there are 604,800 seconds in a week. The leading A indicates that the Expires header should be set to 604,800 seconds after the time the image was accessed by the client browser. Using this technique will also cause your images to be stored in our MA cluster for longer (if possible). This will improve performance.
© 2011-2013 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License