Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jerome 10 posts 90 karma points
    Dec 17, 2020 @ 19:33
    Jerome
    0

    Hello with redirecting multiple sites

    Hi all

    I've installed Umbraco 7. Created 4 websites with different domains. Set the domains under culture and host option.

    Everything seems to be working but what I want to achieve is to redirect each of the 4 sites from the domain name to it's equivalent Https domain name for each of the sites.

    I've added 8 bindings to my IIS project in the format

    Domain.com

    www.domain.com

    So far if I type the domain name as it is, it's fine but after reading around I want to redirect each domain from domain.com to Https://www.domain.com

    I would like to do this through the IIS web.config file.

    I've checked a lot of articles but I can't find s good example to follow.

    Could someone kindly give me some straight forward examples so I can try this out please.

  • Bo Jacobsen 607 posts 2405 karma points
    Dec 17, 2020 @ 20:51
    Bo Jacobsen
    100

    Hi Jerome.

    Maybe you can use this

    <rewrite>
      <rules>
        <rule name="ensure www" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{CACHE_URL}" pattern="^(.+)://(?!www)(.*)" />
          </conditions>
          <action type="Redirect" url="{C:1}://www.{C:2}" redirectType="Permanent" />
        </rule>
        <rule name="http to https" stopProcessing="true">
            <match url="(.*)" />
            <conditions>
                <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                <add input="{HTTP_HOST}" pattern="localhost" negate="true" />
            </conditions>
            <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
    
  • Jerome 10 posts 90 karma points
    Dec 17, 2020 @ 21:02
    Jerome
    0

    Hi Bo

    I'll try this out. I mentioned I have 4 sites.

    Do I just replace CacheUrl with the site name minus www so it knows which site to redirect to which Https? As in copy the rules 4 times?

    Many thanks

  • Amir Khan 1287 posts 2744 karma points
    Dec 17, 2020 @ 21:13
    Amir Khan
    1

    What Bo sent you will redirect all incoming traffic to https, should take care of all of your domains in one swoop.

  • Jerome 10 posts 90 karma points
    Dec 17, 2020 @ 21:18
    Jerome
    0

    Oh great!! So to confirm. I have culture and hosts of 4 different sites set as

    mydomain.com

    www.mydomain.com

    mydomain2.com

    www.mydomain2.com

    And the same for the other Umbraco sites under one CMS.

    Adding the above IIS rule would redirect each site to httpS://www.mydomain.com (note the S in http) where mydomain.com is replaced with the respective domain name set under cultures?

    Thank you all

  • Bo Jacobsen 607 posts 2405 karma points
    Dec 17, 2020 @ 21:32
    Bo Jacobsen
    1

    Hi Jerome.

    ensure www, should redirect which ever domain to use www. Like http://domain.com to http://www.domain.com.

    http to https, should redirect which ever domain to use https. Like http://www.domain.com to https://www.domain.com.

    Umbraco should take care of your domains routing for different cultures.

    But if you have one or more domains that should redirect to another domain, then you can't use this. Like if domain1.com should redirect to domain3.com.

Please Sign in or register to post replies

Write your reply to:

Draft