Http Cache-control header can make the browser cache some resources, we can use it to speed up our site.
To use Cache-control, here are some questions you should answered.
1.What types of files you want to be cached?
2.How long these files will be cached?
You should sure how long these files will be cached by the browser, one day, one week or one month? This value can be determined by the frequency of these files be modified. Images are modified less, so the cache time should be long.
3.How to use .htaccess to enable Cache-control
If you want to cache static files:images, js, css, html,ico. Images will be cached one year, and css,js,html files will be cached one month, you can add code below in your .htaccess file.
# One year for image files <filesMatch ".(jpg|jpeg|png|gif|ico)$"> Header set Cache-Control "max-age=31536000, public" </filesMatch> # One month for css and js <filesMatch ".(css|html|js)$"> Header set Cache-Control "max-age=2628000, public" </filesMatch>