Url rewrite help

Discussion in 'Windows / IIS' started by Andrew Brough, May 25, 2015.

  1. Hi there,

    I have my main site mysite.com and have added another mynewsite.com as a subdirectory in the main project. I added a domain pointer and have added a url rewrite rule as below.

    <rewrite>
    <rules>
    <rule name="mynewsite.com" stopProcessing="true">
    <match url="(.*)" />
    <conditions logicalGrouping="MatchAny">
    <add input="{HTTP_HOST}" pattern="^(www.)?mynewsite.com$" />
    <add input="{PATH_INFO}" pattern="^/mynewsite/" negate="true" />
    </conditions>
    <action type="Rewrite" url="mynewsite\{R:1}" />
    </rule>
    </rules>
    </rewrite>

    now when someone visits mynewsite.com they are shown the new page and it works great. however it also redirects any request from mysite.com the old one to this new page?

    Sorry I am new to url rewrite and I followed instructions on other pages on the forum but cannot get it to work as it should.

    Can anyone tell me what I have done wrong, or how to get it working so that mysite.com and mynewsite.com will work as they should.

    Thanks in advance.

    Andrew
     
  2. sorry, I have managed to get it working ok. I took out the logicalGrouping="MatchAny" and it seems to work now. think I need to read up more on it to see how it all works.

    andy
     
    martino likes this.
  3. martino

    martino DiscountASP.NET Staff

    Hi Andy,

    Not a problem. Glad you where able to figure it out. I remember playing around with URL write. The first time I gave up and the second time I understood it a lot better and was able to complete the task. Just keep on keeping on!
     
    mjp likes this.

Share This Page