【问题标题】:Redirect Url to new Url with ignoring parameters in web.config将 Url 重定向到新的 Url,忽略 web.config 中的参数
【发布时间】:2025-12-26 06:00:11
【问题描述】:

我想将我的旧网址 (../Galary.aspx?cat=10) 重定向到 新网址(../jacket-style-gallery) 但是它附加旧参数。

<rule name="rule9" stopProcessing="true">
  <match url="(.*)" /> 
  <conditions>  
    <add input="{QUERY_STRING}" pattern="cat=10" />  
  </conditions>  
  <action type="Redirect" url="./jacket-style-gallery" appendQueryString="false"/>
</rule> 

所以它重定向到“../jacket-style-gallery?cat=10”

【问题讨论】:

    标签: asp.net redirect iis web-config


    【解决方案1】:

    如果你只想要Galary.aspx

    要被重定向然后你应该使用:

    <rule name="rule9" stopProcessing="true">
      <match url="Galary.aspx" /> 
      <conditions>  
        <add input="{QUERY_STRING}" pattern="cat=10" />  
      </conditions>  
      <action type="Redirect" url="./jacket-style-gallery" appendQueryString="false"/>
    </rule> 
    

    我刚刚在我的服务器上进行了测试,它可以工作。

    【讨论】:

      最近更新 更多