本文主要講解WordPress博客在Win空間上實現偽靜態的方法:
1、寫httpd.ini(寫好后放在網站根目錄下)
[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標簽頁等都可以打開了的。
以上就是關于WordPress博客在Win空間上實現偽靜態的方法,希望對大家有所幫助。
新聞熱點
疑難解答