Click here to Skip to main content
15,901,426 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 should be

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="(.*)" />
               <add input="{URLRedirectionProvider:{URL}}" pattern="(.+)" />
<action type="Redirect" url="{C:1}" appendQueryString="true" />

Any feedback is greatly appreciated.

1 solution

I resolved the issue doing the following:

<rule name="301 Rule" stopProcessing="true">
<match url="^([a-zA-Z0-9_'-]+)/([^)]+)$" />
<add input="{QUERY_STRING}" pattern="parm1=89" />
<add input="{QUERY_STRING}" pattern="parm2=63" /> 
<action type="Redirect" url="" redirectType="Permanent" appendQueryString="false" />
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900