htaccess缓存控制对于WebP图像的应用

6

这是我的htaccess缓存控制策略:

<FilesMatch "\.(flv|gif|jpg|jpeg|png|ico)$"> Header set Cache-Control "max-age=31536000" </FilesMatch>

<FilesMatch "\.(js|css|pdf|swf)$"> Header set Cache-Control "max-age=31536000" </FilesMatch>

<FilesMatch "\.(html|htm|txt)$"> Header set Cache-Control "max-age=600" </FilesMatch>

<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$"> Header unset Cache-Control </FilesMatch> 

<FilesMatch "\.(eot|otf|ttf|woff|woff2|svg)$"> Header set Cache-Control "max-age=31536000" </FilesMatch>

现在,对于WebP图像,是否可以设置缓存控制指令?
非常感谢。
1个回答

0
我通常这样设置,对我来说很有效:
<IfModule mod_expires.c>  
ExpiresActive On  
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|form|webp)$">  
ExpiresDefault "access plus 1 year"  
</FilesMatch>  
</IfModule>  

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接