0

I'm a newbie on this and need some help on creating a rule to rewrite http://dev.test1.com/sub1 to http://dev.test2.com/sub1 as shown below.

<rule name="Route the requests for sub1" stopProcessing="true"> 
<match url="^dev\.(.+)/sub1/(.*)" />
<conditions logicalGrouping="MatchAll">
  <add input="{HTTP_HOST}" pattern="^dev\.(.+)/sub1/(.+)$" /> 
</conditions> 
<action type="Rewrite" url="http://dev.test2.com/sub1/{C:2}" appendQueryString="true" logRewrittenUrl="true" /> 
<serverVariables>
 <set name="HTTP_ACCEPT_ENCODING" value="" /> 
</serverVariables> 
</rule>

I don't realy want to set it up as a redirect as I'm trying to implement this on my reverse-proxy.

Hopefully you can help me out and figure out what I'm doing wrong.

Thank you.

1 Answer 1

0

You don't put the domain in the URL part; you just put the path section. You want something like this:

<rule name="Route the requests for sub1" stopProcessing="true">
    <match url="^sub1/(.*)$" />
    <conditions logicalGrouping="MatchAll">
        <add input="{HTTP_HOST}" pattern="^dev.test1.com" />
    </conditions>
    <action type="Rewrite" url="http://dev.test2.com/sub1/{R:1}" />
</rule>

(above rule is untested, your mileage may vary)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .