日期:2014-05-17 浏览次数:20919 次
通过配置文件控制HTTP的"Expires"和"Cache-Control"头内容,达到缓存静态资源的目的。
?
?
<IfModule mod_expires.c> ExpiresActive On Header unset ETag FileETag None #[access|now (等价于'access')|modification] [plus| ] [n] [years|months|weeks|days|hours|minutes|seconds] ExpiresDefault "access plus 1 month" ExpiresByType image/x-icon "access plus 1 month" ExpiresByType application/x-javascript "access plus 1 weeks" ExpiresByType text/css "access plus 3 days" ExpiresByType image/gif "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType text/plain "access plus 1 weeks" ExpiresByType application/x-shockwave-flash "access plus 1 month" ExpiresByType video/x-flv "access plus 1 month" ExpiresByType application/pdf "access plus 1 month" ExpiresByType text/html "access plus 1 weeks" #客户端GIF有效期为1个月 ExpiresByType image/gif A2592000 #HTML文档的有效期是最后修改时刻后的一星期 ExpiresByType text/html M604800 </IfModule>