URL 重定向 web.config

URL Redirect web.config

我有以下URL

https://www.abcsite.com/?data=w35VTqIaVXWfi4GmESj8EGCG1cdF2aT%2BUF3D?utm_source=external%20system&utm_campaign=external%20system&utm_medium=EX.com&utm_content=MMB

哪个有多余的?在末尾。我想删除并替换为“&”

我正在使用以下规则,但它不起作用。你能回顾一下并告诉我我做错了什么吗?

 <rewrite>
  <rules>
    <rule name="fixdata" stopProcessing="true">
      <match url="\?(.*)\?(.*)$"  ignoreCase="false" />
      <action type="Redirect" redirectType="Permanent" url="http://www.example.com/{R:1}&{R:2}" />
    </rule>
  </rules>
</rewrite>  

谢谢。

你的规则应该是这样的:

<rule name="fixdata" stopProcessing="true">
    <match url=".*" />
    <conditions>
        <add input="{QUERY_STRING}" pattern="(.*)\?utm_source(.*)$" />
    </conditions>
    <action type="Redirect" url="{R:0}?{C:1}&amp;utm_source{C:2}" appendQueryString="False" />
</rule>

您的规则无效,因为 <match url= 包含没有查询字符串的路径。您需要创建其他条件以将查询字符串与您的正则表达式模式匹配