了解IIS 8.0使用正则expression式将https的入站规则重写为httpredirect

我设法使用这个答案为我的网站configuration一个重写规则:

<rule name="Redirect from non www" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_HOST}" pattern="^example.com$" /> </conditions> <action type="Redirect" url="https://www.example.com/{R:0}" redirectType="Permanent" /> </rule> <!-- this is the rule I am interested in --> <rule name="Redirect from non https" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTPS}" pattern="^OFF$" /> <add input="{HTTP_HOST}" pattern="^www.example.com$" /> </conditions> <action type="Redirect" url="https://www.example.com/{R:0}" redirectType="Permanent" /> </rule> 

但是,我很难理解action标签的url属性是如何工作的。 如果我去IIS – >重写规则 – >从非https的redirect – >testing模式 – >inputurlhttp://www.example.com/subdir/?param=value并打testing,我收到{R:0} = http://www.example.com/subdir/?param=value

这是有道理的,因为*正则expression式将匹配整个string。

问题: URL重写引擎如何获取https://www.example.com/subdir/?param=value而不是https://www.example.com/http://www.example.com/subdir/?param=value