Copied to clipboard

Flag this post as spam?

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


  • Bendik Engebretsen 105 posts 202 karma points
    Oct 21, 2016 @ 08:53
    Bendik Engebretsen
    0

    Redirect from root domain to language subfolder

    I have a site with multiple languages organized as follows: Multiple top level nodes, each with Domain (under Culture and Hostnames) set to www.mydomain.com/lang, where "lang" is the two-letter language code. One of them is English i.e. www.mydomain.com/en.

    Now my situation is that the site responds to both www.mydomain.com/somepage and www.mydomain.com/en/somepage. This is fine, but what is not so good is that it leaves the URL in the request as is, which results in the same content rendered from two different URLs. Which is not good for SEO.

    I'm not exactly sure how it became like this, but what I'd like to do now is to redirect all root domain requests (with subpaths) to one with the /en subpath. I.e. www.mydomain.com/somepage -> www.mydomain.com/en/somepage.

    The other solution, which was my first thought, is to use the root domain only for English, and remove /en from the Domain setting. But, Google has indexed a lot of my pages using the /en subpath, so all these links will then end up in a "Page not found". I know that using the root domain only for English could be better for SEO, but how can I then get a general redirect from the /en requests to root domain requests and have Google update its indexing?

    Any ideas and advice will be much appreciated!

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Oct 21, 2016 @ 10:36
    Alex Skrypnyk
    1

    Hi Bendik,

    As I know you just need to create 301 redirect to new location -it's enough for Google reindexing.

    Try to use 301 URL Tracker - https://our.umbraco.org/projects/developer-tools/301-url-tracker/

    You can use Regex redirect for all urls to without /en I think.

    Thanks,

    Alex

  • Bendik Engebretsen 105 posts 202 karma points
    Oct 21, 2016 @ 14:25
    Bendik Engebretsen
    1

    Thanks Alex!

    I think this must be the way to go:-) But my RegEx is just terrible, could you help me out on that?

  • Bendik Engebretsen 105 posts 202 karma points
    Oct 26, 2016 @ 11:42
    Bendik Engebretsen
    1

    Ok, so I figured it out myself. Maybe it is straightforward for experienced 301 URL Tracker users, but I must admit that I was expecting a little more documentation and maybe some examples for it. Anyway, in case anyone else is fumbling with this:

    Root node: /

    Regex: ^en\/(.*)

    Redirect URL: $1

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Oct 27, 2016 @ 12:38
    Alex Skrypnyk
    0

    Hi Bendik,

    Thanks for sharing! Nice job.

    Glad that topic is solved.

    Have a nice day!

    /Alex

Please Sign in or register to post replies

Write your reply to:

Draft