PageSpeed中解决“使用浏览器缓存”的方法

apache环境,在http.conf中新增:

<IfModule mod_expires.c>

ExpiresActive On

<FilesMatch "\.(gif|jpg|png|js|css)$">

ExpiresDefault "access plus 7 days"

</FilesMatch>

</IfModule>

  

或:

ExpiresActive On

ExpiresByType image/gif "access plus 7 day"

ExpiresByType image/jpg "access plus 7 day"

ExpiresByType image/jpeg "access plus 7 day"

ExpiresByType image/x-icon "access plus 7 day"

ExpiresByType image/bmp "access plus 7 day"

ExpiresByType image/png "access plus 7 day"

ExpiresByType text/html "access plus 7 day"

ExpiresByType text/css "access plus 7 day"

ExpiresByType text/txt "access plus 7 day"

ExpiresByType text/js "access plus 7 day"

ExpiresByType application/x-javascript "access plus 7 day"

ExpiresByType application/x-shockwave-flash "access plus 7 day"

保存后重启web服务即可。

 

你可能感兴趣的:(page)