I want to leverage browser caching to increase page speed. It sounds like max-age and and last-modified are good choices, but I’m unclear on how to determine which files I should implement for it. In general, I’m confused on how to actually do this and what the code would look like in my htaccess. I guess I’m looking to get some more explicit help or to be shown some examples. Or maybe someone can direct me to a lesson/tutorial on this that a novice like me can understand, which I haven’t had any luck finding. Any help from someone who knows more about max-age and last-modified and can help tell me how to do this would be greatly appreciated. I am really lost on this and would pay someone to help me. Thanks.
I want to leverage browser caching to increase page speed. It sounds like max-age
Share
A search here on SO would have returned some good information – like Leverage browser caching – but anyway…
From: http://www.samaxes.com/2011/05/improving-web-performance-with-apache-and-htaccess/
Apache enables those headers thanks to
mod_expiresandmod_headersmodules.The
mod_expiresmodule controls the setting of theExpiresHTTP header and themax-agedirective of theCache-ControlHTTP header in server responses.To modify
Cache-Controldirectives other thanmax-age, you can use themod_headersmodule.The
mod_headersmodule provides directives to control and modify HTTP request and response headers. Headers can be merged, replaced or removed.Rule for setting
Expiresheaders:Rule for setting
Cache-Controlheaders:Note: There is no need to set
max-agedirective withCache-Controlheader since it is already set bymod_expiresmodule.must-revalidatemeans that once a response becomes stale it has to be revalidated; it doesn’t mean that it has to be checked every time.More info here: http://www.mnot.net/cache_docs/
And from Google: http://code.google.com/speed/page-speed/docs/caching.html
And Yahoo: http://developer.yahoo.com/performance/rules.html#expires