2
votes

This is the code I put in my htaccess file but it is not working. Maybe I am missing something? or doing something wrong? Help if you can, please.

ExpiresActive On
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
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 1 week"

But, After adding google plus one button to my site and adding google analytics I get these two sugestions on gtmetrix.com

The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:

https://apis.google.com/js/plusone.js (30 minutes) http://www.google-analytics.com/ga.js (12 hours)

How do i write the code in the htaccess to leverage browser catching for these 2. And is it a good idea to leverage browser catching from for google analytics?

1

1 Answers

3
votes

It is not possible to control the expiration time of those two resources by modifying your server's settings. The expiration header has to be set by the origin server (therefore only Google can do that)