wordpress伪静态中文tag标签无法出错

2016-02-22    编辑:ttibm     点击(
昨天自己做了一个wordpress的微博,我就为了优化把路径改成了伪静态,之后就出现了WordPress静态化后中文tag链接找不到,进入404界面,无法打开,后来找到了解决办法。

具体步骤如下:
修改网站 /wp-includes/class-wp.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');

即可

其实我们总结一下就是

 代码如下 复制代码

查找:$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”);

即可了.