wordpress用httpd.ini/web.config伪静态不支持中文解决办法

5次阅读
5 条评论

共计 942 个字符,预计需要花费 3 分钟才能阅读完成。

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 through

RewriteRule /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]

主要是如果连接中含有中文的话,就会转向到404页面,是通过httpd.ini解决不了的,我们必须来修改源代码。

修改网站目录下wp-include/classes.php文件(请先行备份):
(最新3.1/2版需要修改的文件是wp-include/class-wp.php)

第一步:找到
$pathinfo =
$_SERVER[‘PATH_INFO’];
修改为
$pathinfo =$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标签页等都可以打开了的。

正文完
 0
adm1n
版权声明:本站原创文章,由 adm1n 于2011-07-20发表,共计942字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(5 条评论)
2011-07-21 06:10:24 回复

方法很好!值得学习!

     中国广东省广州市电信
2011-08-12 11:03:02 回复

谢谢你的分享!

     中国广东省广州市电信
2011-08-12 11:03:36 回复

支持博主~加油!

     中国广东省广州市电信
2011-08-12 11:04:19 回复

文章不错!学习下!

     中国广东省广州市电信
2011-08-12 11:04:53 回复

帮你顶下~!

     中国广东省广州市电信