wordpress设定Permalink后一个最大的问题是中文不正常,主要原因是IIS解释路径是GBK编码,转给wordpress按UTF-8取值就不对了。
解决办法
打开wp-includes/classes.php文件,找到(大约在154行)
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['PATH_INFO'], "UTF-8", "GBK");
改好后保存上传,再打开中文路径就OK了。