Redirect 尝试将子域重定向到具有查询字符串的域时,IIS URL重写无效

Redirect 尝试将子域重定向到具有查询字符串的域时,IIS URL重写无效,redirect,iis,url-rewriting,Redirect,Iis,Url Rewriting,我有什么对我来说似乎是一个简单的任务与IIS URL重写 我需要根据子域重定向到带有查询字符串的主域。比如说 demo.domain.com需要重定向到 当您访问demo.domain.com时会发生什么 尝试按以下方式更改代码: <rules> <rule name="Redirect" stopProcessing="true"> <match url="(.*)" />

我有什么对我来说似乎是一个简单的任务与IIS URL重写

我需要根据子域重定向到带有查询字符串的主域。比如说

demo.domain.com需要重定向到


当您访问demo.domain.com时会发生什么

尝试按以下方式更改代码:

<rules>
    <rule name="Redirect" stopProcessing="true">
        <match url="(.*)" />
        <conditions trackAllCaptures="true">
            <add input="{HTTP_HOST}" pattern="^demo\.example\.com$" />
        </conditions>
        <action type="Redirect" url="http://www.example.com/?key=demo" appendQueryString="false" redirectType="Found" />
    </rule>
</rules>


看看“add input=”和“action type=”行中的更改,我已经无数次地查看了这些文档,我还没有找到解决方案。还有其他更具体的建议吗?失败请求跟踪是检查重写过程的最佳方法,只有这样,您才能检查步骤以找到问题所在。
<rules>
    <rule name="Redirect" stopProcessing="true">
        <match url="(.*)" />
        <conditions trackAllCaptures="true">
            <add input="{HTTP_HOST}" pattern="^demo\.example\.com$" />
        </conditions>
        <action type="Redirect" url="http://www.example.com/?key=demo" appendQueryString="false" redirectType="Found" />
    </rule>
</rules>