-
Recent Posts
Recent Comments
Categories
Blogroll
Archives
- February 2022
- April 2021
- December 2013
- November 2013
- January 2013
- December 2012
- June 2012
- May 2012
- February 2012
- July 2011
- June 2011
- May 2011
- April 2011
- March 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- January 2010
- December 2009
- October 2009
- August 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- December 2006
- November 2006
- October 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006
- February 2006
- January 2006
- December 2005
Meta
Amazon
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
报名了8月22日的WordCamp Beijing 2009
详情请看谷奥的帖子,官网在这里。 希望能和到场的朋友多多交流,我比较好辨认,因为我的衣服是这个 [singlepic id=461 w=550 h= float=]