Reputation: 5741
When running a Yslow test on a WordPress domain, I get a message like this, which it defines as an issue of high importance:
There are 3 static components without a far-future expiration date.
http://fonts.googleapis.com
/css?family=Anonymous+Pro%3Aregular%2Citalic%2Cbold%2Cbolditalic%7C&ver=3.5.1
http://content.zemanta.com/static/zem-css/modern.css?version=1.3
http://ajax.cloudflare.com/cdn-cgi/nexp/abv=4114775854/cloudflare.min.js
Is it possible to do something -- perhaps set up a rule with my .htaccess -- to resolve this issue, and set an expiry date of a year or so? Or is this completely out of my hands? Thanks!
Upvotes: 1
Views: 1688
Reputation: 1070
So it's saying when a user comes to your website, those files are downloaded every time and therefore slows down how fast your page loads. HTTP headers contain an expire date that allows a users browser to cache these files automatically until those dates expire - where the user would re-download those resources automatically.
This may be of help: https://developers.google.com/speed/docs/best-practices/caching?csw=1#LeverageBrowserCaching
Also, if you can open these files with PHP, you can set the headers yourself:
<?php
// seconds, minutes, hours, days
$expires = 60*60*24*14;
header("Pragma: public");
header("Cache-Control: maxage=".$expires);
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
?>
See http://php.net/manual/en/function.header.php for more information on setting PHP headers.
Upvotes: 1