我设法用两条规则来捏造这一点。没有我想的那么漂亮,但你能做什么?
<rule name="ProductsPagingRule" stopProcessing="false">
<match url="^products([a-z0-9\-/]*)(?:/([0-9]+)/)"/>
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="products{R:1}/?Page={R:2}" />
</rule>
<rule name="ProductsRule" stopProcessing="true">
<match url="^products/([a-z0-9\-/]*)/" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="products.aspx?PageId={R:1}" />
</rule>
我最接近的一条规则是:
^products(?=(?:(?:[a-z0-9\-/]*)/([0-9]+)/$)?)(.[a-z0-9\-/]*)
如果有人觉得勇敢的话,我仍然有兴趣在一条规则中看到这一点......