【问题标题】:Change Query String Value in IIS URL Rewrite Rule更改 IIS URL 重写规则中的查询字符串值
【发布时间】:2018-01-24 21:53:28
【问题描述】:

到目前为止,我已经尝试了多种组合,但没有运气。我有一个如下所示的网址。

https://teams.company.com/Search/pages/results.aspx?url=https://teams2017.company.com/sites/hrdepartment

我想创建一个规则,将查询字符串值从 teams2017 更改为 teams,如下所示。

 https://teams.company.com/Search/pages/results.aspx?url=https://teams.company.com/sites/hrdepartment

我正在使用安装了 IIS 重写规则的 IIS 8.5。

【问题讨论】:

    标签: redirect iis url-rewriting url-redirection


    【解决方案1】:

    你的规则应该是这样的:

    <rule name="teams2017 to teams" stopProcessing="true">
        <match url="^Search/pages/results.aspx$" />
        <conditions>
            <add input="{QUERY_STRING}" pattern="(.*)teams2017(\.company\.com.*)" />
        </conditions>
        <action type="Redirect" url="{R:0}?{C:1}teams{C:2}" appendQueryString="false" />
    </rule>
    

    【讨论】:

    • 我不知道你们是怎么做到的,但它很棒。非常感谢维克多帮助我。这真的很有帮助。我希望我能以某种简单的方式学习这一点。再次非常感谢。 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-13
    • 2020-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多