Web.config文件中的URL重定向规则 [英] URL Redirection Rule in Web.config File

查看:449
本文介绍了Web.config文件中的URL重定向规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I am working on a 301 redirect rule that is suppossed to work like this:
/(A(kdkeidks))/abc/abc/page.aspx?parm=abc&parm=123 should flip to /result

so that means that www.domain.com/(A(kdkeidks))/abc/abc/page.aspx?parm=abc&parm=123 should be www.domain.com/result

This web.config value below doesn't work because somehow it doesn't like the extra parentheses in the URL. I need to find a way to be able to handle this, including these characters on the domain "?" and "&".

<rule name="URLRedirectionRule" stopProcessing="true">
<match url="(.*)" />
      <conditions>
               <add input="{URLRedirectionProvider:{URL}}" pattern="(.+)" />
       </conditions>
<action type="Redirect" url="{C:1}" appendQueryString="true" />
</rule>

Any feedback is greatly appreciated.

推荐答案

我解决了以下问题:



I resolved the issue doing the following:

<rule name="301 Rule" stopProcessing="true">
<match url="^([a-zA-Z0-9_'-]+)/([^)]+)


/ >
< 条件 >
< add 输入 = {QUERY_STRING} pattern = parm1 = 89 / >
< add 输入 = {QUERY_STRING} pattern = parm2 = 63 < span class =code-attribute> / >
< / conditions >
< action type = 重定向 url = http:/ /www.domain.com/result\" redirectType < span class =code-keyword> = 永久 appendQueryString = false / >
< / rule >
" /> <conditions> <add input="{QUERY_STRING}" pattern="parm1=89" /> <add input="{QUERY_STRING}" pattern="parm2=63" /> </conditions> <action type="Redirect" url="http://www.domain.com/result" redirectType="Permanent" appendQueryString="false" /> </rule>


这篇关于Web.config文件中的URL重定向规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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