Copied to clipboard

Flag this post as spam?

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


  • Kazeko 1 post 71 karma points
    Sep 11, 2017 @ 15:27
    Kazeko
    0

    Media Item from single Top Level Domain on Umbraco multisite

    I have Umbraco 7 running a multi language site which looks like this:

    Rootnode

    • NL
    • DE
    • EN
    • FR

    All language nodes have a Top Level Domain attributed to them. So the NL one can be accessed from www.sitename.nl, DE is www.sitename.de etc... Media files are on an azure blob storage and are shared by all language nodes.

    This is all working well, but then I run into trouble with duplicate media items.

    My client wants all media served up from a single TLD for SEO purposes, but I can't get Umbraco to do that.

    The media paths in Umbraco are relative though, so media-item-1 is accessible from www.sitename.nl/media/media-item-1 as well as www.sitename.de/media/media-item-1.

    How can I get media-item-1 to only be accessible through the .nl TLD?

    Any help would be greatly appriciated, I've been banging my head against this for a week now :-(

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Sep 11, 2017 @ 21:20
    Chriztian Steinmeier
    0

    Hi Kazeko,

    How about adding a rewrite for all media that forces the .nl TLD?

    E.g., something like this:

    <rule name="Rewrite for media" stopProcessing="true">
        <match url="^/media/(.*)$" />
        <conditions>
            <add input="{HTTP_HOST}" pattern="\.nl$" negate="true" />
        </conditions>
        <action type="Rewrite" url="http://www.sitename.nl/media/{R:1}" redirectType="Permanent" />
    </rule>
    

    (Start with Found instead of Permanent for easier testing - when you're sure it works, change it back...)

    Hope that helps,

    /Chriztian

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Sep 11, 2017 @ 21:27
    Chriztian Steinmeier
    0

    Another option would be to always add the hostname when rendering media items, so instead of something like this:

    <img src="@Model.Content.PageImage" />
    

    You'd prepend the hostname:

    <img src="http://[email protected]" />
    

    - might actually be the easiest solution :)

    /Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft