Quantcast
Channel: URL Rewrite Module
Viewing all articles
Browse latest Browse all 2482

URL Rewrite escape needs help.

$
0
0

Hello!

This URL can be used.

http://localhost/search.php?searchkey=字符串&searchtype=all&page=2


After rewriting, it cannot be used:


http://localhost/search/all/%D3%CE%CF%B7/2.html


My rules:

------------------------------------------------------
<rule name="UrlEncode example0" stopProcessing="true">
      <match url="^search/all/([^/]+)/([0-9]+)\.html$" ignoreCase="false" />
<conditions>
<add input="{UrlDecode:{REQUEST_URI}}" pattern="search/all/([^/]+)/([0-9]+)\.html" />
</conditions>
<action type="Rewrite" url="/search.php?searchkey={C:1}&amp;searchtype=all&amp;page={R:2}" appendQueryString="false" />
</rule>


or 


<rule name="UrlEncode example1" stopProcessing="true">
<match url="^search/all/([^/]+)/([0-9]+)\.html$" ignoreCase="false" />
<action type="Rewrite" url="/search.php?searchkey={UrlEncode:{R:1}}&amp;searchtype=all&amp;page={R:2}" appendQueryString="false" />
</rule>

------------------------------------------------------


Two rules cannot be used,

Special characters cannot be escaped.


What's wrong? Searchkey = string, request character is Chinese character, and it will be automatically escaped after submission %D7%D6%B7%FB%B4%AE


In Linux nginx PHP, it's normal:

RewriteRule ^search/all/([^/]+)/([0-9]+)\.html$  /search.php?&searchkey=$1&searchtype=all&page=$2  [L]


Please help me, thank you!


Viewing all articles
Browse latest Browse all 2482

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>