TypeCho 轉 WordPress 之後,發現點選中文 tag 出現 404 頁面,也就是點選無效了。試了幾種修改連結樣式,都沒效果。也嘗試了各種網上找的 3 中方法:

第一種方法:開啟
WP-include/classes.php(3.1 之前版本) 或 WP-include/class-wp.php(3.1+之後版本,下文稱新版) 找到第 154 行 (新版為 142 行),把:

$pathinfo = $_SERVER['PATH_INFO';

替換為:

$pathinfo = mb_convert_encoding($_SERVER['PATH_INFO', 'UTF-8', 'GBK');

找到第 159 行 (新版為 147 行),把:

$req_uri = $_SERVER['REQUEST_URI';

替換為:

$req_uri = mb_convert_encoding($_SERVER['REQUEST_URI', 'UTF-8', 'GBK');

PS. 這個方法修改後,上傳覆蓋檔案,直接就網站都打不開了…

第二種方法:1 、在網站的根目錄的 wp-includes 資料夾中找到 「rewrite.php」 這個檔案;2 、備份一下 「rewrite.php」,以防修改出錯 (改程式碼之前我們都最好備份一下原始碼);3 、開啟 「rewrite.php」 檔案中我們找到如下程式碼:

1function get_tag_permastruct() {if (isset($this->tag_structure))
{return $this->tag_structure;}if (empty($this->permalink_structure)) {
//修改這句 $this->tag_structure = '';return false;}if
(empty($this->tag_base))$this->tag_structure = $this->front .
'tag/';else$this->tag_structure = $this->tag_base .
'/';$this->tag_structure .= '%tag%';return $this->tag_structure;}

4 、將其中的

" if (empty($this->permalink_structure)) { 」 修改為 「 if (!
empty($this->permalink_structure)) { ";

注意這個裡面只加了一個英文 「!」 號,經測試,使用的這個方法非常有效。 PS. 直接沒找到這個檔案內說的這段程式碼。。。

第三種方法:最後解決中文 TAG
404 錯誤的方法,其實說到底就是 ISAPI_Rewrite 偽靜態的規則沒有寫好才導致找不到網頁檔案的。其實就是更改一下規則就可以了:之前的 tag 偽靜態的規則

RewriteRule /tag/(.*)$ /index.php?tag=$1

更改後的規則

RewriteRule /tag/(.*)/$ /index.php?tag=$1

PS. 跟自己的不符.. 求其他方法~~~