Add caching directives that browsers will use to cache static assets on the client-side. Can have significant impact on the perceived speed of website page loads.

To instruct web browsers to cache static assets for 1 year, use the following rule (note that mod_expires must be enabled on the server):

<IfModule mod_expires.c>
	<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
	Header set Cache-Control "max-age=31536000, public"
	</FilesMatch>
</ifModule>

Upon first request of a static asset whose extension is in the pipe-delimited list above, say logo.png, the browser will locally cache the file. Subsequent requests for the file logo.png will be served from the browser’s local cache rather than re-requesting logo.png from the server (until the cache expires, in this case 1 year, or until the user clears their browser cache or it is otherwise purged from their browser cache).

Note that the only downside to using static asset caching is the loss of control when an updated logo.png might be introduced; if the old logo.png has been cached by the browser, IT will be served rather than the updated file. Renaming the file will cause the new file to be served, or cache-busting techniques such as appending a query_string to the static asset’s url, as in logo.png?v=1.2.3 will address this as well.