Redirect 使用查询字符串重写URL

Redirect 使用查询字符串重写URL,redirect,iis,rewrite,query-string,url-rewrite-module,Redirect,Iis,Rewrite,Query String,Url Rewrite Module,我正在用类型重定向在IIS中编写重写规则。我希望新url有一个新添加的查询字符串参数值。旧url没有任何查询字符串值 实现这一目标的最佳方式是什么 旧url:abc.com/2017/Sample Page 新Url:test.abc.com/2017/Sample Page?重定向=y <rule name="rewrite with query string" stopProcessing="true"> <match url="(.*)2017/Sample-Pa

我正在用类型重定向在IIS中编写重写规则。我希望新url有一个新添加的查询字符串参数值。旧url没有任何查询字符串值

实现这一目标的最佳方式是什么

旧url:abc.com/2017/Sample Page

新Url:test.abc.com/2017/Sample Page?重定向=y

<rule name="rewrite with query string" stopProcessing="true">
    <match url="(.*)2017/Sample-Page(.*)" />
    <conditions>
      <add input="{HTTP_HOST}" pattern="abc.com" />
    </conditions>
    <action type="Rewrite" url="http://test.abc.com/{R:0}?redirect=y"/>
  </rule>

这起作用了:

<rule name="rewrite with query string" stopProcessing="true">
    <match url="(.*)2017/Sample-Page(.*)" />
    <conditions>
      <add input="{HTTP_HOST}" pattern="abc.com" />
    </conditions>
    <action type="Rewrite" url="http://test.abc.com/{R:0}?redirect=y"/>
  </rule>

这起作用了:

<rule name="rewrite with query string" stopProcessing="true">
    <match url="(.*)2017/Sample-Page(.*)" />
    <conditions>
      <add input="{HTTP_HOST}" pattern="abc.com" />
    </conditions>
    <action type="Rewrite" url="http://test.abc.com/{R:0}?redirect=y"/>
  </rule>


可能与我尝试过的相同,但不起作用。此外,我的原始URL中没有查询字符串。您上面的示例显示的是“重写”而不是“重定向”。您确定这不是问题所在吗?我尝试了一些事情。它应该是重定向的。仍然不起作用。可能是我试过的,没有起作用。此外,我的原始URL中没有查询字符串。您上面的示例显示的是“重写”而不是“重定向”。您确定这不是问题所在吗?我尝试了一些事情。它应该是重定向的。仍然不起作用。这与你在问题中的重写规则相同。修改了什么来解决您的问题?这与您在问题中使用的重写规则相同。什么改变了你的问题?