Allow chinese chracters in url rewriting

我是研究僧i 提交于 2019-12-06 10:32:57
Gaurav_0093

Just add this:

<match url="^([_0-9a-z-]+)/([_0-9a-z-]+)/([_0-9a-z-‘!@#$%^*()!~`\.&quot;\u4e00-\u9fa5]+)"/>

In place of this:

<match URL="^([_0-9a-z-]+)/([_0-9a-z-]+)/([_0-9a-z-‘!@#$%^*()!~."]+)"/>

Then your problem will solved.

Thanks for the useful question and answer!
Just adding here for anybody has the same question but looking for an answer for the Arabic Unicode characters (0600–06FF, 255 characters) instead, then it is as follows:

<match url="^([_0-9a-z-]+)/([_0-9a-z-]+)/([_0-9a-z-\u0600-\u06FF]+)"/>

Search for the unicode of the characters here (if you are not using simplified chinese please search for YourLanguage unicode table on google.

if you want to write (this is the fifth character in the table i linked you to) you need to write \u4E08 in which 4E08 is the unicode. so 中国陕西西安 translates to \u4E2D\u56FD\u9655\u897F\u897F\u5B89.

.htaccess rules use RegEx for matching.

regexr with example

You will have to create a custom provider for URL rewrite and replace these Chinese characters with normal characters

refer http://www.iis.net/learn/extensions/url-rewrite-module/developing-a-custom-rewrite-provider-for-url-rewrite-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!