为上述东东设置缓存一个长长的缓存时间。比如1年,那么在第一次访问后,用户在这一年中都不用下载背景图,flash,css,js 。当然前提是你没有修改
方法 是修改网站根目录.htaccess文件
加入如下代码
| <ifmodule mod_expires.c> <FilesMatch ".(html|htm)$ "> Header set Cache-Control "max-age=43200″ </FilesMatch> #cache css, javascript and text files for one week <FilesMatch ".(js|css|txt)$ "> Header set Cache-Control "max-age=604800″ </FilesMatch> #cache flash and images for one month <FilesMatch ".(flv|swf|ico|gif|jpg|jpeg|png)$ "> Header set Cache-Control "max-age=2592000″ </FilesMatch> #disable cache for script files <FilesMatch ".(pl|php|cgi|spl|scgi|fcgi)$ "> Header unset Cache-Control </FilesMatch> </ifmodule> |
三、总结
恩,暂时的优化就是这些,通过这些优化,晋城吧 的yslow评分从50 D 上升到80+ B ,有些页面的评分为90+ A.总体还是很有效果的。
如果你需要转发此文,还请保留晋城吧链 接,如果能帮忙做个友链,那就太感谢了。。。
附上一些网站在07年Yslow的评分
Amazon D
AOL F
CNN F
eBay C
Google A
MSN F
MySpace D
Wikipedia C
Yahoo! A
YouTube D
作者:晋城吧
文章来源:http://www.jincheng8.com.cn/thread-303-1-1.html







