Redirect IIS在URL中使用不寻常的~字符重写

Redirect IIS在URL中使用不寻常的~字符重写,redirect,iis,url-rewriting,iis-8,iis-8.5,Redirect,Iis,Url Rewriting,Iis 8,Iis 8.5,我有一个URL,格式如下: https://www.example.com/aaa/bbb/product/~productId=abc123 我想重定向到: https://www.example.com/product/abc123 我已经尝试了一些变化,但就是无法让它接受(尽管在IIS URL重写正则表达式测试仪中进行了测试) 根据您的描述,我建议您可以尝试使用下面的url重写规则 <rule name="specialcharacter" stopPro

我有一个URL,格式如下:

https://www.example.com/aaa/bbb/product/~productId=abc123
我想重定向到:

https://www.example.com/product/abc123
我已经尝试了一些变化,但就是无法让它接受(尽管在IIS URL重写正则表达式测试仪中进行了测试)


根据您的描述,我建议您可以尝试使用下面的url重写规则

            <rule name="specialcharacter" stopProcessing="true">
                <match url="aaa/bbb/product/~productId=(.*)" />
                <action type="Redirect" url="https://www.example.com/product/{R:1}" />
            </rule>

            <rule name="specialcharacter" stopProcessing="true">
                <match url="aaa/bbb/product/~productId=(.*)" />
                <action type="Redirect" url="https://www.example.com/product/{R:1}" />
            </rule>