在网站根目录下的.htaccess文件中添加以下代码
expiresactive on
expiresbytype image/gif a2592000
expiresbytype image/jpeg a2592000
expiresbytype image/png a2592000
expiresbytype application/x-shockwave-flash a2592000
expiresbytype text/css a2592000
expiresbytype application/x-javascript a2592000
expiresbytype application/javascript a2592000
expiresbytype text/javascript a2592000
expiresbytype text/html a600
setoutputfilter deflate
mod_gzip_on yes
mod_gzip_dechunk yes
mod_gzip_item_include file \.(html?txtcssjsphppl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^content-encoding:.*gzip.*
header unset last-modified
fileetag none
现在使用firefox的yslow插件,以small site or blog标准测试的分数为99分,以yslow2(v2)标准测试的分数为94分,被扣掉的几分主要是因为没有使用cdn。所以现在速度已经被优化到了极致。
赶快把它放到你的网站或blog根目录下的.htaccess文件里吧。
