Copied to clipboard

Flag this post as spam?

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


  • Chris Roberts 74 posts 106 karma points c-trib
    Feb 17, 2011 @ 18:05
    Chris Roberts
    0

    Change content based on host header.

    Hello,

     

    I have a site with a number of sub-domains - site1.mysite.com, site2.mysite.com, site3.mysite.com - for example.

    I'd like to basically render the same site for each sub-domain, but change the odd piece of content based on which sub-domain the user is visiting on.

    It seems like I ought to be able to do this with dictionary items, but I can't really see how.

    Any pointers would be appreciated!

    Thanks,

    - Chris

  • Daniel Bardi 927 posts 2562 karma points
    Feb 17, 2011 @ 19:52
    Daniel Bardi
    0

    You can check get the host in xslt, then use xslt choose to render a specific template based on the host value.

     

    <xsl:variable name="host" select="umbraco.library:RequestServerVariables('HTTP_HOST')" />
    <xsl:choose>
     <xsl:when test="$host = 'site1.domain.com'">
    ... do something
     </xsl:when>
     <xsl:when test="$host = 'site2.domain.com">
     ... do something else
     </xsl:when>
    </xsl:choose>

     

  • 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