If you’ve checked your YSlow score lately, you make have come across a poor score in your “Add Expires Header”. In many cases that I’ve seen, the score is 0% – not good.
Here’s a great description of Expires Headers from GTmetrix:
Expires headers tell the browser whether they should request a specific file from the server or whether they should grab it from the browser’s cache.
The whole idea behind Expires Headers is not only to reduce the load of downloads from the server (constantly downloading the same file when it’s unmodified is wasting precious load time) but rather to reduce the number of HTTP requests for the server.
In the most basic terms, we’re giving the site assets an expiration date. Below is the solution I use on nearly all of the sites I build and manage. No need for a plugin or functions file update.
Just paste the following in your .htaccess file:
The Plugin Route
If you’re already using W3 Total Cache, you can add the Expires Header under the Browser Caching options in the Dashboard. I’ve used both the these methods without any issues, and each has it’s benefits and limitations.
I’m interested in hearing about other solutions and suggestions. Please share your thoughts below.