kad
kad

Reputation: 189

The best values for Leverage Browser Caching?

I am attempting to speed up my website by changing the .htacces file browser leverage values. I am not sure what values to use? ie one week, one month or more. I am currenlty designing my website, so making many changes. Should I take this into consideration when choosing the values? Please find below my code:

    ## EXPIRES CACHING ##
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year" 
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/pdf "access plus 1 month"
    ExpiresByType text/x-javascript "access plus 1 month"
    ExpiresByType application/x-shockwave-flash "access plus 1 month"
    ExpiresByType image/x-icon "access plus 1 year"
    ExpiresDefault "access plus 2 days"
    </IfModule>
    ## EXPIRES CACHING ##

Upvotes: 0

Views: 669

Answers (1)

Gerben
Gerben

Reputation: 16825

Your caching is quite aggressive, so to get the browser to download a new file instead of using the cached one you either have to specify more normal values, or add versioning to the files. Just google "cache busting"

If you are still changing the site, it should be 1 week tops. I myself us something like 2 days. Since most browsers support 304 I don't really see the point of using expires. (I do see the point, but the cost for me to implement it correctly doesn't add up to the very small benefits you get)

Upvotes: 1

Related Questions