Home  >  Article  >  php教程  >  设置图片的HTTP缓存

设置图片的HTTP缓存

WBOY
WBOYOriginal
2016-06-07 11:45:502160browse

如果是Apache环境下面,可以在.htaccess文件中添加下面的代码,用于设置图片的HTTP缓存和有效期(需要开启apache的headers模块支持),减少网站的图片资源请求压力,提高访问速度和你的pagespeed值^_^。<ifmodule><br> <filesmatch><br> Header set Cache-Control "max-age=604800"<br> </filesmatch></ifmodule>上面的代码设置了网站的图片使用为期一周的HTTP缓存,当然,你一样可以给js或者css文件加上http缓存哦。

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn