How to get the query string in iis url rewrite

salndplm 21 Reputation points
2022-06-21T15:21:19.993+00:00

I want redirect from https://example.com/list?afcbd879675a to https://example.com/test.aspx?code=afcbd879675a

I am new to iis, can anyone help me?

Internet Information Services
0 comments No comments
{count} votes

Accepted answer
  1. Sam Wu-MSFT 7,036 Reputation points Microsoft Vendor
    2022-06-22T01:56:09.99+00:00

    @salndplm

    You can try this rule:

    <rule name="test" stopProcessing="true">   
     <match url="(.*)" />  
       <conditions>  
         <add input="{HTTP_HOST}" pattern="example.com" />  
         <add input="{QUERY_STRING}" pattern="(.*)" />  
       </conditions>  
     <action type="Redirect" url="https://example.com/test.aspx?code={C:0}" />  
    </rule>  
    

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful