Copied to clipboard

Flag this post as spam?

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


  • J 447 posts 864 karma points
    Jan 04, 2016 @ 15:04
    J
    0

    Canonical URLs

    Umbraco v6.

    I have one Umbraco installation with two sites. Second site was added under the "Culture and Hostnames" options.

    Under Site 1 Culture and Hostnames is empty but controlled by IIS. Under Site 2 Culture and Hostnames has http://site2.com

    When a user navigates to http://site1.com they reach site 1.

    When a user navigates to http://site2.com they reach site 2.

    So all works as expected.

    Is there anyway to add canonical domains so that

    http://site2.com changes to http://www.site2.com

    http://site1.com changes to http://www.site1.com

    Note the www for each URL.

    Is this possible to keep the functionality as is but with the changes mentioned above?

  • Pradip 24 posts 116 karma points
    Jan 05, 2016 @ 08:34
    Pradip
    0

    Please refer the below link which help you to achieve the above goals :

    http://www.wiliam.com.au/wiliam-blog/web-design-sydney-enforcing-a-canonical-domain-in-iis-for-seo-performance

  • J 447 posts 864 karma points
    Jan 05, 2016 @ 09:21
    J
    0

    Does that article apply to this issue? If i carried out those instructions in IIS wouldnt that redirect site1 and site2 to the one site that i set as the main site?

  • Pradip 24 posts 116 karma points
    Jan 05, 2016 @ 10:01
    Pradip
    0

    Yes, you can apply it to this issue.

    I think if you apply this rules then it will not redirect to http://site1.com. It will redirect you to http://www.site1.com.

  • J 447 posts 864 karma points
    Jan 05, 2016 @ 10:30
    J
    0

    What about site2? If add that rule what would happen if the user types in http://site2.com?

    Remember there is 1 IIS site 1 Umbraco installation and 2 sites in this 1 installation which point to two different websites.

  • Pradip 24 posts 116 karma points
    Jan 05, 2016 @ 10:54
    Pradip
    0

    You have to create a new rule for site2 like site1.

    You can create a number of rules for one site.

  • J 447 posts 864 karma points
    Jan 05, 2016 @ 13:42
    J
    0

    What i did was add two canonical rules and got the error "Too many redirects"

    rule 1 - selected the site, under URL Rewrite > Add rule, selected site 1 rule 2 - selected the same site, under URL Rewrite > Add rule, selected site 2

    Any further thoughts?

  • Pradip 24 posts 116 karma points
    Jan 06, 2016 @ 09:03
    Pradip
    100

    Hi J,

    You need to write the below two rules in the web.config file if you want to redirect site1.com to www.site1.com and site2.com to www.site2.com :

    <rewrite>
    <rules>
    <rule name="Redirectsite1.comtowww" patternSyntax="Wildcard" stopProcessing="true">
        <match url="*" />
        <conditions>
          <add input="{HTTP_HOST}" pattern="site1.com" />
        </conditions>
        <action type="Redirect" url="http://www.site1.com/{R:0}" />
      </rule>
    
      <rule name="Redirectsite2.comtowww" patternSyntax="Wildcard" stopProcessing="true">
        <match url="*" />
        <conditions>
          <add input="{HTTP_HOST}" pattern="site2.com" />
        </conditions>
        <action type="Redirect" url="http://www.site2.com/{R:0}" />
      </rule>
     </rules>
    </rewrite>
    

    I have tested the above two rules on local site and its working fine for me.

  • J 447 posts 864 karma points
    Jan 08, 2016 @ 09:49
    J
    0

    Thank you - this did the trick

  • Jonathan Maurer 5 posts 72 karma points
    Oct 11, 2017 @ 14:36
    Jonathan Maurer
    0

    This can be simplified to:

    <rewrite>
    <rules>
    <rule name="sitetowww" patternSyntax="Wildcard" stopProcessing="true">
        <match url="*" />
        <conditions>
          <add input="{HTTP_HOST}" pattern="(site2.com|site1.com)" />
        </conditions>
        <action type="Redirect" url="http://www.{C:1}/{R:0}" />
      </rule>
     </rules>
    </rewrite>
    
Please Sign in or register to post replies

Write your reply to:

Draft