Aug
15
WordPress 2.6 升级到 2.6.1
Filed Under Wordpress | Leave a Comment
刚才登陆了wordpress的后台,看到 dashboard 那里有提示 2.6.1版本发布了,自然是先升级了,因为是小版本号升级,数据库就没有备份。2.6.1这个版本官方说是修正了60多个bug,当然包括iis url 重写出现得bug。
还是有问题中文tag,不知道 wordpress 是怎么弄得,也许是 url 编码(windows的)不同地区不同的缘故。还得参照自己的帖子改过来wordpress 中文 url 的问题 。
wordpress 通常升级的步骤是:
1,备份数据库,推荐装个插件WordPress Database Backup,用起来很方便。
2,就是到官方下载最新的版本,记住不要用迅雷下载,可能返回旧的版本。
3,把风格换为默认风格。
4,运行升级脚本,http://your-blog-url/wp-admin/upgrade.php
Aug
12
wordpress 中文 url 的问题
Filed Under Wordpress | Leave a Comment
先前一篇文章介绍了一个wordpress iis 下 ISAPI_Rewrite的一个新规则
如果大家用了那个规则,可以看到英文的url不会有任何问题,但含有中文的会返回404页面。
服务器是windows 2003的,默认字符集是gbk编码的,前面的文章有介绍这类的文章
比如
http://www.humker.com/2008/05/17/character-set/
专门介绍了字符集的区别
php用的字符集是utf-8的,这样与服务器的交互就会有问题。
如果是乱码文章就不会回显变量值,以前一个ecms的批量插入软件的插件就是这个问题,读取不了中文目录。
下面的文章解决了中文url的问题,当然不仅仅是tag的问题,因为她的方法是让所有的url重新编码。
如何让WordPress的tag支持中文
http://www.bolarn.com/index.php/2008/01/26/52/
这篇文章主要改动的是
wp-includes\classes.php文件
找到
if ( isset($_SERVER['PATH_INFO']) )
$pathinfo = $_SERVER['PATH_INFO'];
else
$pathinfo = '';
$pathinfo_array = explode('?', $pathinfo);
$pathinfo = str_replace("%", "%25", $pathinfo_array[0]);
$req_uri = $_SERVER['REQUEST_URI'];
替换为
if ( isset($_SERVER['PATH_INFO']) )
$pathinfo = mb_convert_encoding($_SERVER['PATH_INFO'], "UTF-8", "GBK");
else
$pathinfo = '';
$pathinfo_array = explode('?', $pathinfo);
$pathinfo = str_replace("%", "%25", $pathinfo_array[0]);
$req_uri = mb_convert_encoding($_SERVER['REQUEST_URI'], "UTF-8", "GBK");
原文处css有问题不能完全显示,这里又贴了一遍。
另外一个就是替换一个文件 taxonomy.php
google搜索“wordpress-26-chinese-tags-bug-fixed.zip”,本站就不提供下载了。
这个文件有望在2.6.1里修正,主要目的是中文 tag 页回显 title 有问题。
另外如果使用本站新的url rewrite规则,还要修改一个文件
具体参考这个文章
http://trac.wordpress.org/ticket/5682
if ( empty( $_SERVER['REQUEST_URI'] ) )
替换为
if ( empty( $_SERVER['REQUEST_URI'] ) || substr( $_SERVER['SERVER_SOFTWARE'], 0, 13 ) == 'Microsoft-IIS' )
Aug
12
wordpress iis isapi Permalinks 新规则
Filed Under Wordpress | Leave a Comment
最近准备用wordpress做一个cms类的站,要考虑Permalinks(也就是简洁url)的问题,url的seo
优化是一个最基础的东西。wordpress的url的问题涉及到url重写(url rewrite)的,url重写是apache的
长项,不过iis加了ISAPI_Rewrite 也差不多,不过规则什么的就要另外考虑了。
前一段时间自己的blog使用了一个中文wordpress网上流传最多的规则,一共三组,也就是本站前几天发布
的一篇blog,
wordpress iis url rewrite
http://www.humker.com/2008/07/26/wordpress-iis-url-rewrite/
这个规则好理解跟apache的其中一类规则一样,就是一条对应一种url相应,用正则表达式给括号变量赋值,
这个规则对分页总是有问题,这就让我不得不考虑其他的方法。
找到了
http://www.binaryfortress.com/wordpress-url-rewrite/
这个专门为wordpress写的iis的rewrite补丁。
好在跟空间商关系不错,让他帮忙装上了,很好用,就一个配置文件,很省事,就是一个问题是不能实现带有.html 这类扩展,路径中带点的
都不行。
今天不知道怎么不管用,估计是影响其他用户,空间商给停了。
这下没办法了,只有搜,还是google的好用。
找到了这个东西
http://www.basilv.com/psd/blog/2006/running-wordpress-20-under-iis
一个全新的 ISAPI_Rewrite 规则
[ISAPI_Rewrite]
# Defend your computer from some worm attacks
#RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# Rules to ensure that normal content gets through
RewriteRule /software-files/(.*) /software-files/$1 [L]
RewriteRule /images/(.*) /images/$1 [L]
RewriteRule /favicon.ico /favicon.ico [L]
# For file-based wordpress content (i.e. theme), admin, etc.
RewriteRule /wp-(.*) /wp-$1 [L]
# For normal wordpress content, via index.php
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php/$1 [L]
一切ok。
PS:
在这里补充一句中文类的网站copy现象太严重了,找这类东西最好用google,挂上美国的代理,搜外国人写的东西。下一篇文章是介绍中文tag,分类,文章名的问题。
Aug
10
wordpress双引号全角和半角
Filed Under Wordpress | Leave a Comment
wordpress有一个毛病就是将英文的标点符号有半角转为全角,别人复制粘贴你的程序代码时就出现了问题,我的红旗x window起不来就是这个原因。
一个插件Quotmarks Replacer 2.1作者地址
http://sparanoid.com/project/quotmarks-replacer-21/
通过禁用 wptexturize 函数,解决 WordPress 自动将半角的单引号、双引号和省略号转换为全角标点的问题。使后台输入的标点格式与前台读者浏览的标点格式保持一致。
Jul
26
本站wordpress iis 下 url 重写规则,基本上是抄来的。
使用的是isapi,好像还有一个mod_rewrite没有过多研究。
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP# # Below is for permalink like /%year%/%monthnum%/%day%/%postname%/
# # Maybe dumplicate with above!!RewriteRule /tag/(.*) /index\.php\?tag=$1
RewriteRule /(contact|about-copyright|favor|archives|tags|sitemap|about)/ /index\.php\?pagename=$1
RewriteRule /category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed\.php\?category_name=$1&feed=$2
RewriteRule /category/?(.*)/ /index\.php\?category_name=$1
RewriteRule /author/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed\.php\?author_name=$1&feed=$2
RewriteRule /author/?(.*) /index\.php\?author_name=$1
RewriteRule /feed/?$ /wp-feed\.php/\?feed=rss2
RewriteRule /comments/feed/?$ /wp-feed\.php/\?feed=comments-rss2
RewriteRule /page/(.*)/ /index\.php\?paged=$1
RewriteRule /([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/?([0-9]+)?/?$ /index\.php\?year=$1&monthnum=$2&day=$3&name=$4&page=$5
RewriteRule /([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /index\.php\?year=$1&monthnum=$2&day=$3&page=$4
RewriteRule /([0-9]{4})/([0-9]{1,2})/?$ /index\.php\?year=$1&monthnum=$2&page=$3
RewriteRule /([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /index\.php\?year=$1&monthnum=$2&day=$3&name=$4&feed=$5
RewriteRule /([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$ /wp-trackback\.php\?year=$1&monthnum=$2&day=$3&name=$4&tb=1
RewriteRule /page/(.*)/?s=(.*) /index\.php\?s=$2&paged=$1