更改IIS URL重写规则中的查询字符串值 [英] Change Query String Value in IIS URL Rewrite Rule

查看:153
本文介绍了更改IIS URL重写规则中的查询字符串值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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

我使用的是安装了IIS重写规则的IIS 8.5.

I am using IIS 8.5 with IIS Rewrite rule installed.

推荐答案

您的规则应为:

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

这篇关于更改IIS URL重写规则中的查询字符串值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆