Getting the Elusive “A” for ‘Cache Static Content’ on Webpagetest.org

Getting a high score on Webpagetest.org for “Cache Static Content” for a WordPress site can be tough. W3 Total Cache does a great job with some of the other metrics, but it won’t get you all the way there for “Cache Static Content”. Welcome Pubcon 2013 visitors!

Here’s our screenshot, looking good…

wpt

Here’s the Code:

You need to FTP to your hosting account, and make a manual entry to your .htaccess file (as always, be careful with that file and keep a backup).

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif A31536000
ExpiresByType image/jpg A31536000
ExpiresByType image/jpeg A31536000
ExpiresByType image/png A31536000
ExpiresByType image/bmp A31536000
ExpiresByType text/css A31536000
ExpiresByType text/javascript A31536000
ExpiresByType application/javascript A31536000
ExpiresByType application/x-javascript A31536000
</IfModule>

So, why did we score only a “B”? Because we load google fonts from their repository/API, and we haven’t figured out how to cache that content.

1 reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *