|
如果您发现本文排版有问题,可以先点击下面的链接切换至老版进行查看!!!
解决本站wordpress中文标签tag无法打开、无法伪静态问题
将本站的isapi rewirte用的httpd.ini 公布如下 #Wordpress # # 形式:/PostID.html# # 自定义链接 /%post_id%.html(本站使用的固定链接格式)
- # # 形式:/PostID.html
- # # 自定义链接 /%post_id%.html
- #RewriteRule /(about|contact|about-copyright|favor|archives|tags|sitemap|taotao) /index\.php\?pagename=$1
- RewriteRule /category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed\.php\?category_name=$1&feed=$2
- RewriteRule /category/?(.*) /index\.php\?category_name=$1
- RewriteRule /author/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed\.php\?author_name=$1&feed=$2
- RewriteRule /author/?(.*) /index\.php\?author_name=$1
- RewriteRule /feed/?$ /index.php?feed=rss2
- RewriteRule /comments/feed/?$ /index.php?feed=comments-rss2
- RewriteRule /comments/feed/?$ /wp-feed\.php/\?feed=comments-rss2
- # RewriteRule /([0-9]+)/?([0-9]+)?/?$ /index\.php\?p=$1&page=$2
- # RewriteRule /([0-9]+)/?([0-9]+)?/?$ /index\.php\?p=$1&page=$2
- RewriteRule /([0-9]+).html /index\.php\?p=$1
- RewriteRule /page/(.*)/?s=(.*) /index\.php\?s=$2&paged=$1
- RewriteRule /page/(.*) /index\.php\?paged=$1
- RewriteRule /date/([0-9]{4})([0-9]{1,2})([0-9]{1,2})/([^/]+)/?([0-9]+)?/?$ /index\.php\?year=$1&monthnum=$2&day=$3&name=$4&page=$5
- RewriteRule /date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /index\.php\?year=$1&monthnum=$2&day=$3&page=$4
- RewriteRule /date/([0-9]{4})/([0-9]{1,2})/?$ /index\.php\?year=$1&monthnum=$2&page=$3
- RewriteRule /([0-9]+).html/(feed|rdf|rss|rss2|atom) /index\.php\?feed=rss2&p=$1
- RewriteRule /([0-9]+).html/trackback /wp-trackback\.php\?p=$1
- #标签
- RewriteRule /tag/(.*)/page/(\d+)$ /index\.php\?tag=$1&paged=$2
- RewriteRule /tag/(\d+)$ /index\.php\?tag=$
- RewriteRule /software-files/(.*) /software-files/$1 [L]
- RewriteRule /sitemap.xml /sitemap.xml [L]
- RewriteRule /favicon.ico /favicon.ico [L]
- RewriteRule /wp-(.*) /wp-$1 [L]
- RewriteRule ^/$ /index.php [L]
- RewriteRule /(.*) /index.php/$1 [L]
复制代码 除了上面的伪静态规则外,我们要知道产生中文tag标签链接无法打开的原因在于WordPress不支持中文的编码,那么我们就需要让WordPress能支持中文的编码形式,也就是UTF-8和GBK编码,具体的做法就是打开wordpress目录下的wp-includes文件夹,然后修改classe-wp.php(老版本的wordpress应该是classes.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”);
复制代码 为了防止出错,请大家下载wordpress安装包,修改完之后再上传到服务器上。 至此,wordpress中文标签链接打不开显示404错误的问题就完美的解决了
|
|