简体   繁体   中英

Change Query String Value in IIS URL Rewrite Rule

I have tried multiple combinations so far but no luck. I have a URL like below.

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

I want to create a rule that will change the query string value from teams2017 to teams only, like below.

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

I am using IIS 8.5 with IIS Rewrite rule installed.

You rule should be like that:

<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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM