做wordpress博客的朋友都知道喜歡弄偽靜態(tài)什么的,而Windows空間要想完美支持偽靜態(tài)可得大費(fèi)周章,找了不少的教程,自己也摸索了下,一個(gè)字累,還好最后搞定了.
網(wǎng)上的教程幾乎都是博客鏈接能偽靜態(tài),可中文標(biāo)簽的鏈接打不開,出現(xiàn)404錯(cuò)誤頁(yè),而下面介紹的方法則是非常完美的.
下面就說(shuō)說(shuō)如何完美實(shí)現(xiàn)WordPress博客的偽靜態(tài).
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] //Vevb.com
- # For normal wordpress content, via index.php
- RewriteRule ^/$ /index.php [L]
- RewriteRule /(.*) /index.php/$1 [L]
2、比如博客地址含有中文,或者是標(biāo)簽是中文的,就會(huì)轉(zhuǎn)向到404頁(yè)面,是通過(guò)httpd.ini解決不了的,必須來(lái)修改源代碼.
修改網(wǎng)站目錄下wp-includes/class-wp.php文件(請(qǐng)先行備份):
第一步:找到
$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標(biāo)簽頁(yè)等都可以打開了的,現(xiàn)在看是不是可以完美解決了呢,哈哈 總共就兩步還是蠻簡(jiǎn)單的.
新聞熱點(diǎn)
疑難解答
圖片精選