WordPress中文标签tag无法显示的解决办法
WordPress点击中文标签提示找不到文章的页面,有以下几种解决方法
修改wp-includes/rewrite.php
这是网上最常见的方法,原理是,让WordPress在对其他内容使用Permalink的时候,对tag不使用,而使用链接2的QueryString模式发送中文编码:
function get_tag_permastruct() {
if (isset($this->tag_structure)) {
return $this->tag_structure;
}
if (empty($this->permalink_structure)) { //-----this line need change------
$this->tag_structure = '';
return false;
}
把第5行改为
if (!empty($this->permalink_structure)) {
如果你用的是windows主机,还可以这样做:
原理是,IIS会将PathInfo中的UTF-8转换成GBK,而QueryString中就不会转换,故而为了使用Permalink,采用以下方法:
打开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");
这种发放的缺点是 :只对Windows主机、且必须是Windows下的IIS主机有效。
相关日志
WordPress错误Fatal error: Maximum execution time of 30 seconds exceeded ingodaddy的windows主机运行WordPress报500错误:500 - Internal server error
wordpress清爽素雅主题
如何处理WordPress文章修订版本
wordpress日志同步到QQ空间Qzone
随机文章
Discuz论坛伪静态.htaccess怎么写Discuz批量删除未审核通过的帖子和主题
Godaddy的Deluxe - Windows主机续费成功
discuz 与phpwind 论坛比较分析[转]
Discuz 7 自动生成添加标签Tag
本博客主题模板下载OfficeFolders-WordPress
在wordpress原主题模版上手动添加tag标签
godaddy的windows主机设置discuz7.2静态化
2010年10月godaddy优惠码(持续更新中)
Google Adsense好像被国内的墙了