2017-08-16 147 views
0

迄今为止,我尝试了多种组合,但没有运气。我有一个像下面的URL。更改IIS URL重写规则中的查询字符串值

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

我想创建一个规则,将查询字符串值从teams2017只,像下面改变。

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

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

回答

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

我不知道你们是如何做到这一点,但它的辉煌。非常感谢Victor帮助我。这真的很有帮助。我希望我能以一种简单的方式学习这一点。再次非常感谢。 :) –