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

后端 未结 3 2095
醉话见心
醉话见心 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:46

    I tested all of above codes, But see no change in gtmetrix rank. Using this improved Cache-Control (Specify a cache validator) rank for my wordpress site:

    ## EXPIRES CACHING ##
    
    ExpiresActive On
    ExpiresByType image/jpg "access 1 year"
    ExpiresByType image/jpeg "access 1 year"
    ExpiresByType image/gif "access 1 year"
    ExpiresByType image/png "access 1 year"
    ExpiresByType text/css "access 1 month"
    ExpiresByType application/pdf "access 1 month"
    ExpiresByType text/x-javascript "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresDefault "access plus 1 year"
    
    ## EXPIRES CACHING ##
    
    
      
        Header set Cache-Control "max-age=2592000, public"
      
    
      
        Header set Cache-Control "max-age=2592000, public"
      
    
      
        Header set Cache-Control "max-age=216000, private"
      
    
      
        Header set Cache-Control "max-age=216000, public, must-revalidate"
      
    
      
        Header set Cache-Control "max-age=1, private, must-revalidate"
      
    
    

    I recommend you to customize max-age values for your site and it's files yourself.

提交回复
热议问题