Leverage browser caching

前端 未结 2 1254
天涯浪人
天涯浪人 2020-12-29 07:46

According to: http://code.google.com/speed/page-speed/docs/caching.html#LeverageBrowserCaching I should be using browser caching. However, I don\'t know how.

Do I s

2条回答
  •  死守一世寂寞
    2020-12-29 08:12

    You can do something like this in your .htaccess.

      ## 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 2 days"
    
      ## EXPIRES CACHING ##
    

提交回复
热议问题