1

I want to host multiple Top Level Domains (TLDs) off of the same web application.

Scenario: www.mywebsite.com has language sub-folders of /en-us/, /en-gb/, /fr-ca/, /ja/, etc... So www.mywebsite.com/en-gb/ would be the UK version of the site.

UK users should go to www.mywebsite.co.uk but be routed to www.mywebsite.com/en-gb/

In IIS, I've set the bindings for this web application to handle both www.mywebsite.com and www.mywebsite.co.uk domains.

The URL Rewrite 2.0 module is added to IIS and includes this rule:

<rewrite>
  <rules>
    <rule name="CanonicalHostNameRule" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="^www\.mywebsite\.co\.uk$" />
      </conditions>
      <action type="Rewrite" url="http://www.mywebsite.com/en-gb/{R:1}" />
    </rule>
  </rules>
</rewrite>

Users who go to www.mywebsite.co.uk have the URL rewritten to www.mywebsite.com/en-gb/, however, I want the URL to remain www.mywebsite.co.uk for them, and in fact, I would want the www.mywebsite.com/en-gb/ to be rewritten to www.mywebsite.co.uk for consistency.

I'm still not even quite sure what the proper terminology is for what I want to do. So far I've run across 'multi-tenancy', 'application request routing', 'URL routing', 'URL rewriting', and a few others.

Here are a few resources I've been reading to try and figure out how best to handle this. Am I on the right track? I haven't found a good example that demonstrates doing this with TLD's.

Community
  • 1
  • 1
nwayve
  • 2,291
  • 23
  • 33

0 Answers0