Adding far future expires headers will help to speed up your site by having cache last longer on the viewers web browser. It will not help the first time they load your site, but it will improve the loading speed every visit after that.
You can set when cache expires by Seconds, Minutes, Hours, Days, Weeks, Months, and Years. You can set a default expires date, by using ExpiresDefault
For example “ExpiresDefault 1 month” would set the default expiration of cache to be one month from now.
ExpiresDefault “access plus 2 weeks”
The above code will cache the file types listed for 2 weeks before the browser will try to get new ones.
One thing to keep in mind with this however is that the browser will not check for updates until the cache expires. So you’ll want to be careful with the file types you are setting this on, as well as how long you are setting it. For example, if you have a .jpg file that you change every few days, then you should not set the expires headers to 2 weeks. It should only be a day or 2.
You can specify individual files like this in a .htaccess
ExpiresByType image/jpg A604800
The default is set to 0 seconds, so everything would expire right away. The jpg is set to 1 week.
A604800 is one week in seconds (60*60*24*7)
The “A” in the timestamp is required. It means to expire from the date it was viewed. Alternatively, you can swap the “A” for an “M”. An “M” Means from the time the file was last modified.