We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28120
    • 380 Posts
    Is is possible to have one context with multiple domains?

    I know it's usually the other way around with multiple contexts, one per domain.

    But in this case the differences in the content between domains is tiny so ideally I'd like to serve the one resource with a bit of 'if' logic that might change something like the contact phone number.

    In every page header I'll have

    <link rel="alternate" hreflang="x-default" href="http://www.domain.com/page-title.html">
    <link rel="alternate" hreflang="en-gb" href="http://www.domain.co.uk/page-title.html">
    


    to fix any Google duplication issues
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      One very simple way would be to use output modifiers, if there's only a few of these differences and they are small.

      [[++site_url:is=`www.domain.com`:then=`something`:else=`something else`]]


      Your .htaccess should be making sure that nothing else gets through except those two.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 28120
        • 380 Posts
        Thanks

        I thought of that but didn't know how to configure MODX.

        Do I point both contexts to the same content?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          I thought you were using one context.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 28120
            • 380 Posts
            Good point. See just how confusing I'm finding this subject!

            What I meant was how do I get site_url to change contingent on the domain name? Do I set it in htaccess?
              • 28120
              • 380 Posts
              Ignore the last question. site_url is set dynamically from the HTTP_HOST value of the server.

              [[!++site_url]] is now doing it, thanks!