https://stackoverflow.com/questions/16998832/iis-url-rewrite-rn-clarification
And using the input string www.foo.com in the conditions, you will have:
{C:0} - www.foo.com
{C:1} - www.
{C:2} - foo.com
To make it simple:
{R:x} is used as back reference from the rule pattern ().
{C:x} is used as back reference from the condition pattern ()
The 0 reference contains the whole input string
The 1 reference will contain the first part of the string matching the pattern in the first parenthesis (), the 2 reference the second one, etc…up to the reference number 9
Note:
When “Wildcard” pattern syntax is used, the back-references are always created when an asterisk symbol (*) is used in the pattern. No back-references are created when “?” is used in the pattern.
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(test)" negate="true" />
</conditions>
<action type="Rewrite" url="/test/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
需要IIS安装url rewrite
注意要点
1.参数用“()” 括起来 ,使用 {R:1}来获得参数
2.多个参数中间用 & 分割
3. name切记不能写一样