Copied to clipboard

Flag this post as spam?

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


  • Frej Raahede Nielsen 26 posts 59 karma points
    Nov 19, 2009 @ 10:45
    Frej Raahede Nielsen
    0

    Primary domain in Umbraco

    Hi,

     

    I'm looking for a way to set up a primary domain on a site.

    I have 4 URLs to the same site, but need one of them to be the active one, and the others to point to it:

    • domain.com (primary)
    • www.domain.com
    • domain.us
    • www.domain.us

    It should be so that when you e.g. type www.domain.us in your browser, you go to domain.com through a 301 redirect.

     

    Can anyone help me with this? It doesn't seem to be a built in feature in Umbraco.

     

    _Frej

  • Chris Houston 535 posts 980 karma points MVP admin c-trib
    Nov 19, 2009 @ 11:10
    Chris Houston
    0

    Hi Frej,

    You can do this by using the built in URL re-writing.

    In the UrlRewriting.config file add the following:

        <add name="301ReDirect_For_US_Domain"
    redirect="Domain"
    ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite"
    virtualUrl="http://www.your-domain.us/(.*)"
    destinationUrl="http://www.your-domain.com/$1" />

    The name is just whatever you want to call the rule.

    Cheers,

    Chris

  • Chris Houston 535 posts 980 karma points MVP admin c-trib
    Nov 19, 2009 @ 19:12
    Chris Houston
    0

    Hi,

    Sorry to say I was wrong about this one! The above creates a 302 re-direct, not sure if there is any way to make it do a 301, anyone?

    Have a look at this forum post where this has just been discussed.

    http://our.umbraco.org/forum/using/ui-questions/5255-301-redirect-options

    Cheers,

    Chris

  • Chris Houston 535 posts 980 karma points MVP admin c-trib
    Nov 19, 2009 @ 23:12
    Chris Houston
    1

    Actually... scratch that!

    I just found the documentation and it is possible ( And I have fixed my re-direct :) )

    You need to add:  redirectMode="Permanent"

    E.g.

        <add name="301ReDirect_For_US_Domain"
                   
    redirectMode="Permanent"
                   redirect="Domain"
                   
    ignoreCase="true" rewriteUrlParameter="IncludeQueryStringForRewrite"
       
    virtualUrl="http://www.your-domain.us/(.*)"
       
    destinationUrl="http://www.your-domain.com/$1" />

    And you can see this working if you open up firebug and look at the network section and then hit the following URL, as I have just updated my redirect using this.

    http://www.nursingpersonnel.co.uk

    Should 301 re-direct to:

    http://www.nursing-personnel.co.uk

    Cheers,

    Chris

     

  • How Do I Delete My Account? 68 posts 433 karma points
    Aug 03, 2015 @ 12:15
    How Do I Delete My Account?
    0

    Nice one. Ty! =)

  • Frej Raahede Nielsen 26 posts 59 karma points
    Nov 25, 2009 @ 09:45
    Frej Raahede Nielsen
    0

    Thanks a lot!

    This works like a charm :-)

    _Frej

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies