Tag Archives: guao

解决 wordpress 使用 cos-html-cache 插件后评论分页和画廊的问题

事情是这样的,从7月份起,谷奥的wordpress全面采用了东哥的cos-html-cache插件对首页以及帖子进行静态化处理,效果非常不错。但是使用一段时间后发现了几个和原始程序冲突的小地方,想了个比较笨的方法解决了一下,本人编程小白,憋了半天鼓捣出的代码,各位读者见笑了。如果您有更好的解决方法,欢迎和大家分享。 1,评论分页问题: 谷奥的permalink格式是 http://google.org.cn/posts/google-wave-nominate-for-guao-readers.html/ 这样,这里的.html是一个真正的静态化htlm文件,如果在后台打开了评论分页的话,分页链接就会是类似 http://google.org.cn/posts/google-wave-nominate-for-guao-readers.html/comment-page-12#comments 这样的格式。很显然这个链接会返回404 2,Feed中的画廊跳转问题: 这里的画廊是指wordpress自带的gallery,比如这个帖子。如果在gallery的属性中,把"Link thumbnails to:"选成Image File后,直接在浏览器打开帖子时gallery图片的链接是没有问题的(直接链接到图片本身)。但是在rss中,图片的链接却是 http://android.google.org.cn/posts/samsung-behold-ii-caught-behind-glass.html/samsung-behold-ii-ctia-05 这样的格式,显然又是一个404。 3,解决方法 经过考虑后,觉得还是使用301来对这种url进行处理最为简便:分页评论直接指向index.php处理的预览结果(使用预览(?preview=true)可以防止跳转到permalink,感谢东哥的这个tip),而图片链接则直接跳转到图片本身。具体方法如下,修改.htaccess: #redirect paged comments RedirectMatch 301 /posts/(.*).html/comment-page-(.*)  http://google.org.cn/gkp/guao-paged-comment-tran.php?cpage=$2\&permalink=$1 #redirect gallery in feeds RedirectMatch 301 /posts/(.*).html/(.*) http://google.org.cn/gkp/guao-gallery-tran.php?picname=$2 直接将分页和rss图片跳转的url 301到php文件,guao-paged-comment-tran.php: <? include(‘./config.php’); $permalink = $_GET[‘permalink’]; $permalink = … Continue reading

Posted in 电脑相关 | Tagged , , | 3 Comments

报名了8月22日的WordCamp Beijing 2009

详情请看谷奥的帖子,官网在这里。 希望能和到场的朋友多多交流,我比较好辨认,因为我的衣服是这个 [singlepic id=461 w=550 h= float=]

Posted in 我的慵懒生活 | Tagged , , | Leave a comment