Pseudo static URL Chinese scrambled code problem solution

  • 2020-05-12 06:29:34
  • OfStack

In version 1.3 of ISAPI_Rewrite, as long as the UrlEncode operation is carried out on URL, Chinese can be normally received, but in version 3.1, the receiving page using GB2312 will be scrambled.

After using ISAPI_Rewrite 3.x, it is found that the encoded characters will become scrambled. If you do not encode them in Chinese, they will be formatted as GBK string. The solution is to add the NU parameter at the end of the RewriteRule rule to restore the normal state. The solution to the problem of ISAPI_Rewrite is as follows:

1. When transferring URL, urlencode is applied to Chinese, which is correct.
2. If it is ISAPI_Rewrite 3.x only need to add NU parameter.

Here are two examples of pseudo-static rules with strings of Chinese characters:

1. Modification of Discuz pseudo-static personal space rules:


RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1 [NU]

2. For Chinese character search in ShopEx pseudo-static, the modification rules are as follows:


RewriteRule ^(.*)$ index.php?$1 [QSA,NU,PT,L]

The blue part is the modified part.


Related articles: