由於他們都是 Win 主機,而我們做 WP 部落格的朋友都知道喜歡弄偽靜態什麼的。而 Win 空間要想完美支援偽靜態可得大費周章,小冬亦是,找了不少的教程,自己也摸索了下,一個字累,還好最後搞定了.

網上的教程幾乎都是部落格連結能偽靜態,可中文標籤的連結打不開,出現 404 錯誤頁。而下面介紹的方法則是非常完美的。

下面就說說如何完美實現 WP 部落格的偽靜態:

1 、寫 httpd.ini(用記事本即可,寫好後放在根目錄下 OK)

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# Rules to ensure that normal content gets throughRewriteRule /software-files/(.*) /software-files/$1 [L]
RewriteRule /images/(.*) /images/$1 [L]
RewriteRule /sitemap.xml /sitemap.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
# For file-based WordPress content (i.e. theme), admin, etc.
RewriteRule /wp-(.*) /wp-$1 [L]
# For normal WordPress content, via index.php
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php/$1 [L]

2 、比如部落格地址含有中文,或者是標籤是中文的,就會轉向到 404 頁面,是透過 httpd.ini 解決不了的,必須來修改原始碼。

修改網站目錄下 wp-includes/class-wp.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 標籤頁等都可以開啟了的。

現在看是不是可以完美解決了呢,,哈哈 總共就兩步還是蠻簡單的!