默认的wordpress规则中,是没有中文支持的,如果你的标签是用中文的,那么就会出现404,怎么解决这个问题呢?我们先来看看默认的规则是怎样的:
[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 /sitemap.xml /sitemap.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
# For file-based wordpress content (i.e. theme), admin, etc.
总共有两种方法:一种是修改伪静态的规则,一种是修改程序,野狼是提倡修改伪静态规则的。
第一种方法,修改伪静态的规则,如下(红色部分是新添加的)
第二种是修改程序,野狼是提倡修改伪静态规则的。
[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 /sitemap.xml /sitemap.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
# For tag(中文标签以及标签翻页的规则by 伪静态博客www.weijingtai.org)
RewriteRule /tag/(.+)$ /index.php?tag=$1
RewriteRule /tag/(.*)/page/(d+)$ /index.php?tag=$1&paged=$2
# For category(中文分类以及分类翻页的规则)
RewriteRule /category/(.*) /index.php?category_name=$1 RewriteRule
/category/(.*)/page/(d+)$ /index.php?category_name=$1&paged=$2
# 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]
修改网站目录下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标签页等都可以打开了的。
还没有人来评论,快来抢个沙发吧!