简体   繁体   中英

sub domain hosted on another server but call it from Url Rewrite in iis 7 in domain

I have one portal like www.mywebsite.com and it has one module like booking. Current flow in url is that www.mywebsite.com/booking/. This is fine for current situation but we are moving to high volume traffic and want to divide it to multiple part with country and region wise and host booking module to multiple servers.

Now my question is that we can url rewrite in main website like,

www.mywebsite.com/us-ny-booking/ to booking-us-ny.mywebsite.com ( is hosted on different server ).

Is this working or not ?

You probably could go with something like:

<rewrite>
    <rules>
        <rule name="My redirect" stopProcessing="true">
            <match url="^(abc|pqr)/?(.*)?$" />
            <conditions>
                <add input="{HTTP_HOST}" pattern="^(abc|pqr)\.mywebsite\.com$" negate="true" />
            </conditions>
            <action type="Redirect" url="http://{R:1}.mywebsite.com/{R:2}" />
        </rule>
    </rules>
</rewrite>

What it does:

  • Checks that the url starts with abc or pqr
  • Makes sure that the host isn't already starting with abc or pqr
  • Redirects to abc.mywebsite.com/whatever or pqr.mywebsite.com/whatever depending on the original request

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM