一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

shopex ISAPI_Rewrite3.x中文乱码解决办法

时间:2012-03-16 编辑:简简单单 来源:一聚教程网

解决方案是

翻了手册,发现有一个配置参数可以解决该问题:

 代码如下 复制代码

nounicode|NU
If NU flag is set, transformation from Unicode to UTF-8 will not take place and all Unicode characters remain encoded in %xx format.
nounicode|NU

如果标志设置,从Unicode转换为UTF-8不会发生,所有的Unicode字符编码为%xx的保持格式
在你的RewriteRule 规则后台添加 NU 即可恢复正常。

关于ISAPI_Rewrite中文变乱码解决方法,无论何种情况,统一解决思想:
1、在传输URL时,将中文进行urlencode,这样是没错的。

。把最后一句的规则添加个NU参数,RewriteRule ^(.*)$ index.php?$1 [QSA,NU,PT,L]

配置举例:
传递的URL地址:

 代码如下 复制代码
http://www.111com.net /sell/search-htm-kw-%C6%BD%B0%E5%B5%E7%C4%D4.html
原来相应的RewriteRule为:
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
修正后的规则是:
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2 [NU]

shopex原规则为:

 代码如下 复制代码
RewriteBase /
RewriteCond %{REQUEST_FILENAME} .(html|xml|json|htm|php|php2|php3|php4|php5|phtml|pwml|inc|asp|aspx|ascx|jsp|cfm|cfc|pl|cgi|shtml|shtm|phtm|xml)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]
 代码如下 复制代码

修改后的规则为:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} .(html|xml|json|htm|php|php2|php3|php4|php5|phtml|pwml|inc|asp|aspx|ascx|jsp|cfm|cfc|pl|cgi|shtml|shtm|phtm|xml)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [NU,L]

热门栏目