Redirect root domain to other host, but subsites underneath should not redirectRSS

1 reply

Last post Oct 09, 2019 06:24 AM by Jalpa Panchal

  • Redirect root domain to other host, but subsites underneath should not redirect

    Oct 09, 2019 03:29 AM|KVive|LINK

    I've tried this, and cannot get it working for some reason. The Pattern test seems to work, but could not get it working when live.

    I want to have users come to:

    www.domain.com they will be redirected to secondhost.domain.com

    anything in www.domain.com/subsite or www.domain.com/default.aspx will continue on to what is hosted in that server with out redirecting

    Is this possible?

  • Re: Redirect root domain to other host, but subsites underneath should not redirect

    Oct 09, 2019 06:24 AM|Jalpa Panchal|LINK

    Hi,

    You could use below url rewrite rule:

     <rule name="test" enabled="true" stopProcessing="true">
    <match url="(.*)" negate="false" />
    <conditions>
    <add input="{HTTP_HOST}" pattern="^www\.domain\.com$" />
    <add input="{REQUEST_URI}" pattern="(.*)" />
    <add input="{REQUEST_URI}" pattern="^/default\.aspx$|^/default$" negate="true" />
    <add input="{REQUEST_URI}" pattern="^/subsite/$" negate="true" />
    </conditions>
    <action type="Redirect" url="http://localhost" />
    </rule>

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.