分类: C/C++
2011-09-05 14:04:03
在网站根目录下的.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?|txt|css|js|php|pl)$
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文件里吧。
原文地址:http://zhiqiang.org/blog/it/using-htaccess-to-speed-blog.html