http://www.yysonline.com/html/y2009/m09/446.html
cos-html-cache wordpress 静态化插件
插件主页:www.storyday.com/html/y2007/1213_cos-html-cache-wordpress-static-release-of-plug-in.html
下载地址:wordpress.org/extend/plugins/cos-html-cache
**** 概述****
cos-html-cache 将会大大地提高你wordpress的运行效率和载入速度。该插件会在页面第一次载入的时候产生和url对应的真正的html文件作为缓存,后面的运行将 会直接载入该html从而大大的提高了页面的效率。当页面内容发生变化时将会自动更新对应的页面,更新缓存的触发事件有:修改文章、删除文章、评论成功提 交,同时这些事件也将会更新与之相邻的文章。
cos-html-cache2.0和之前的版本相比大大的提高了速度,改进了缓存的机制,使之更加科学
**** description ****
cos-html-cache is an extremely efficient WordPress page caching plugin designed to make your WordPress site much faster and more responsive. Based on URL rewriting, the plugin will automatically generate real html files for posts when they are loaded for the first time, and automatically renew the html files if their associated posts are modified.
cos-html-cache. Current version, cos-html-cache2.3, is a huge improvement over previous versions of cos-html-cache.
For English users, just Download Plugin and view the readme.txt closely.
**** 与之前版本不同之处****
- 完全从缓冲区获取数据,写入缓存的速度提高至少一个数量级;
- 正是由于第一个原因,所以仅仅只有在未登录状态并且第一次访问页面的时候生成缓存;
- 兼容wordpress2.3以及2.x;
**** 安装****
- 首先,永久连接不能使用默认格式;
- 修改你的永久链接格式,保证你的url路径看起来像真正的HTML文件的路径(废话一句:这个是需要url rewrite支持的),中 文推荐采用 /html/y%year%/%post_id%.html如果你和我一样不怕麻烦愿意为每篇文章写一个英语的post slug,建议采用这样的格式:/html/y%year%/%post_id%_%postname%.html,最好不要直接用year和 month,因为这个会和存档出现冲突;
- 放置html文件的文件夹属性请设置成 0777(linux特有设置);
- 下载插件,解压缩,你将会看到一个文件夹cos-html-cache,请确认文件夹里面没有二级目录,然后将其放置到插件目录下,插件目录通常是 `wp-content/plugins/`;
- 在网站根目录下创建一个文件名为”index.bak”,设置属性为0666(好多朋友反映无法生成首页,请注意这里);
- 在后台对应的插件管理页激活该插件;
- 请确保你WP的gzip压缩未打开(今后的版本如果没有此选项,忽略之) ,如图:

- 安装完成;
**** installation ****
- Upload to your plugins folder, usually `wp-content/plugins/` and unzip the file, it will create a `wp-content/plugins/cos-html-cache/` directory;
- Activate the plugin on the plugin screen;
- Make sure that you deactivated compression on the Miscellaneous options screen and that gzip encoding is turned off on the PHP level;
- create a file named “index.bak” under the root of your web directory;
- change the permanent url of you blog, to make it looks like a real html url,eg: /html/post-id.html ;
**** 卸载插件 ****
- 进入后台 admin->选项->cos-html-cache
- 点击按钮删除所有的html缓存文件(请一定要删除)
- 进入插件管理界面,取消该插件。
- 卸载完成
**** FAQ ****
- 我后缀名是.htm不是.html的可以用么?
只支持html和html后缀。 - 如果我的永久连接是目录形式的可以用么?
不可以。 - 缓存的静态HTML文件在哪里?
放在你URL链接对应的地方,比如你页面的地址是http://www.xxx.com/dir1/dir2/2.html 那么静态文件就在 dir1/dir2 目录下 - 为什么可以生成index.html,但是文章的静态页面失败?
如果你的静态页面将在 folder下,请保证folder的属性为0777 - 为什么后台没有批量更新了?
请看最前面的说明,2.0的机制发生变化,已经不需要这个功能了! - 如果我的永久连接不合理怎么办?
放心修改就是,不用担心链接失效问题,我自己都修改过几次,看看这里:http://www.storyday.com/html/y2007/706_permalinks-migration-plugin.html - 静态化后不支持pingback,如何处理?
在你的模板文件夹下的header.php文件中,加上这样的pingback meta:<link rel=”pingback” href=”<?php bloginfo(’pingback_url’); ?>” />,加在css调用之前,当调用静态文件的时候,htaccess和这个meta会帮你处理ping back的! - 如果确定静态化成功?
FTP查看有没有html文件生成,或者看看当前页面的源代码的最后面是否有这样的代码:<!– create at yyyy-mm-dd hh:mm:ss by cos-html-cache 2.0 –> - 生成了index.html为什么访问的还是index.php
服务器配置文件访问优先级的问题,本插件无能为力,请修改服务器配置,如果你的服务器支持自定义htaccess,请在htaccess中增加DirectoryIndex index.html index.htm index.php index.cgi。 - 有没有好的永久连接建议?
基本没有,我的永久连接格式是:/html/y%year%/%post_id%_%postname%.html这样能保证所有的html缓存都在html文件夹下,并且文件名始终唯一。 - 为什么我第一次访问post的时候看不到静态页面?
因为你是登录状态,只有在作者未登录的状态下才能生成静态文件(这里也是大家迷惑的地方,所以退出登陆后你便可以看到静态化成功了)。 - 使用这个插件之后搜索失效了,怎么处理?
方法1是换用Google搜索代替内建的搜索功能;
方法2就是修改模板内的searchform.php文件。将action=”<?php bloginfo(’url’); ?>” 替代为action=”<?php bloginfo(’url’); ?>/index.php”。可能某些模板的搜索栏并非位于侧边栏,比如包含在header文件,请采用同样的方法修改之。