.htaccess: How to “Specify a cache validator”?

后端 未结 3 2078
醉话见心
醉话见心 2020-12-24 07:18

I\'m running Google PageSpeed on my site and it\'s tell me that I need to
\"Specify a cache validator.\"

The following resources are missing a cache validator. R

3条回答
  •  春和景丽
    2020-12-24 07:58

    In order to "Set A Cache Validator" you need to send the following in your headers:

    Expires or Cache-Control: max-age

    AND

    Last-Modified or ETag

    So, for example, in PHP you could add the following for CSS and JS files:

    
        Header set Expires "Thu, 21 May 2013 20:00:00 GMT"
        Header set Last-Modified "Thu, 21 May 2012 20:00:00 GMT"
    
    

    This will satisfy Google's Pagespeed calculator.

提交回复
热议问题