Setting the expiration date or maximum presence time for static resources in the HTTP header instructs the browser to load previously downloaded resources from the local disk instead of being loaded over the network. This allows the site to load more quickly.
The following code needs to be placed in the. htaccess to take effect. The recommended setting expires at one months, which is: max-age=2592000.
Set by FilesMatch
<filesmatch ". (FLV|GIF|JPG|JPEG|PNG|ICO|SWF|CSS|JS) $ ">
Header set Cache-control "max-age=2592000"
</FilesMatch>
Set by MOD_EXPIRES.C
<ifmodule mod_expires.c>
Expiresactive on
ExpiresDefault "Access plus 1 months"
Expiresbytype text/html "Access plus 1 months"
Expiresbytype image/gif "Access plus 1 months"
Expiresbytype image/jpeg "Access plus 2 months"
Expiresbytype Application/x-shockwave-flash "Access plus 2 months"
Expiresbytype application/x-javascript "Access plus 2 months"
</IfModule>
This is required for specific resource types:
Expiresbytype image/gif "Access plus 5 hours 3 minutes"