2014-11-02 89 views
0

我有.htaccess文件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 ## 

这个代码,但我仍然有“杠杆浏览器缓存”的错误时,我想测试我的网站速度!

当我试图查看错误的详细信息: -

使用上面的代码之前,我有很多的联系! 现在我只有PNG,JPG,js文件。

希望你能帮助我。

回答

0

您需要启用指定mod_expires。 与Apache:

a2enmod expires 
service apache2 restart