通过mod_expires模块设置Expires
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 30 days"
ExpiresByType css/html "access plus 30 days"
ExpiresByType css/css "access plus 30 days"
ExpiresByType images/gif "access plus 30 days"
ExpiresByType images/png "access plus 30 days"
ExpiresByType images/jpeg "access plus 30 days"
ExpiresByType images/ico "access plus 30 days"
</IfModule>
通过mod_headers模块来设置Expires
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control “max-age=604800, public”
</FilesMatch>
<FilesMatch "\.(xml|txt)$">
Header set Cache-Control “max-age=18000, public, must-revalidate”
</FilesMatch>
<FilesMatch "\.(html|htm|php)$">
Header set Cache-Control “max-age=3600, must-revalidate”
</FilesMatch>
沒有留言:
張貼留言