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


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版需要修改的文件是wp-include/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标签页等都可以打开了的。

其他

将 127.0.0.1/cts/index.php?p=1 转到 127.0.0.1/cts/p1.html

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase
/cts/
RewriteRule
^p([0-9]+)\.html$ index.php?p=$1
</IfModule> 本文转自黄聪博客园博客,原文链接:http://www.cnblogs.com/huangcong/archive/2011/07/05/2097966.html,如需转载请自行联系原作者
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值