来源:http://www.fufuok.com/wordpress-chinese-tag.html
WordPress 中文 Tag 链接无法正常访问的问题想必多数使用 Windows+IIS 主机的朋友都有遇到,以前出现这个问题增加一条伪静态规则就可以解决,见:IIS 下实现 WordPress 伪静态,换了虚拟主机后不行了。找到一些可行的解决办法,摘录如下:
产生这个问题的主要原因是地址编码问题,及UTF-8和GBK之间转换的问题。IIS 对 URL 截取的时候取得的是 GBK 编码,但是 WordPress 中文都用的 UTF-8 编码,所以我们要对编码进行处理后再交给数据库进行查询。
一、转换编码解决 WordPress 中文 Tag 链接问题(推荐)
打开文件:wp-includes\classes.php
查找:
$pathinfo = $_SERVER['PATH_INFO'];
修改为:
$pathinfo = mb_convert_encoding($_SERVER['PATH_INFO'], "UTF-8", "GBK");
再查找:
$req_uri = $_SERVER['REQUEST_URI'];
修改为:
$req_uri = mb_convert_encoding($_SERVER['REQUEST_URI'], "UTF-8", "GBK");
保存,上传,问题解决。
二、禁止 Tag 伪静态解决 WordPress 中文 Tag 链接问题
打开文件:wp-includes/rewrite.php
查找:
function get_tag_permastruct() {
修改这个函数中的:
if (empty($this->permalink_structure)) {
为:
if (!empty($this->permalink_structure)) {
完成。
Hello colleagues, its impressive piece of writing about teachingand entirely defined, keep it up all the time.
回复删除