redirect problem

hhzz 21 Reputation points
2022-05-22T12:33:13.747+00:00

I want to create a rule that satisfies the following two urls to redirect at the same time.

mydomain.com/test1 -> mydomain.com/index.html

mydomain.com/test1/test2 -> mydomain.com/index.html

note: test1 and test1/test2 are dynamic

Internet Information Services
0 comments No comments
{count} votes

Accepted answer
  1. Sam Wu-MSFT 7,036 Reputation points Microsoft Vendor
    2022-05-23T01:26:09.157+00:00

    @hhzz

    You can use the following case as a reference:

    <rule name="test" stopProcessing="true">            
         <match url="(.*)" />  
               <conditions>  
                     <add input="{REQUEST_URI}" pattern="^/([^/]+)" />  
               </conditions>  
         <action type="Redirect" url="http://mydomain.com/{C:1}/index.com" redirectType="Found" />  
    </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