我在.htaccess文件上有这段代码
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
# Media
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType application/x-shockwave-flash "access plus 1 year"
# Codes
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 year"
# Webfonts
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType font/opentype "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##
但我仍然遇到错误&#34;利用浏览器缓存&#34;当我试图测试我的网站速度时!
当我尝试查看错误详情时: -
在使用上面的代码之前,我有很多链接! 现在我只有png,jpg,js文件。
希望你能帮助我。
答案 0 :(得分:0)
您需要启用mod_expires。 用apache:
a2enmod expires
service apache2 restart