We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39545
    • 9 Posts
    Hi there,

    I have a .co.uk site running on modx Evo, and my client is looking to have a .com version of the same site with slightly different copy in some places. Changing content based on the url should be fairly easy but the main problem is I need to have a single modx install accessible through 2 different urls, does anyone know if this is possible?

    I've experimented locally and set up a rewrite rule in the .htaccess of the .com site, and then by fiddling with config.inc I can change the base_url of the site depending on whether its the .co.uk or the .com, which means all the links work etc. The problem is (for example) when someone accesses the .com homepage, modx will cache that and then subsequently viewing the homepage of the .co.uk site will bring up the cached .com homepage.

    If anyones got any suggestions that would be great, I have a suspicion that what I'm trying to do might not be possible.

    thanks!

    This question has been answered by Jako. See the first response.

    • discuss.answer
      • 13428 ☆ A M B ☆
      • 1,031 Posts
      The changed parts of the installation have to be controlled by uncached snippets then. Otherwise you will always run into that caching trap since the cache of MODX is resource based.

      But Evo 1.0.14 has the option to cache the page on base of $_GET parameters, too. So if you set a $_GET parameter with a plugin in OnParseDocument according to the value in $_SERVER['HTTP_HOST'] and change the MODX system setting 'Site' -> 'Document caching type' to 'Cache is based on Resource ID and $_GET parameters' different the caching of both sites is is possible at the same time.

      Caution: you should avoid duplicate content …
        • 14214
        • 299 Posts
        I have done this in Revo but not evo. In Revo having the multiple contects you can do this a number of ways. Then using context settings create placeholders in your content to change output. I am using the same templates with placeholders for the logo, site name, intro text, footer content etc.
          • 39545
          • 9 Posts
          Thanks Jako, thats worked a treat.

          I have to do it slightly differently because of the redirects I'm using $_SERVER['HTTP_HOST'] is always the same for either 'site', so I have to look at $_SERVER['HTTP_X_FORWARDED_HOST'] to find whether its been forwarded from .com or is .co.uk.

          Now I just need to change the base_url of the site in better manner than hardcoding it into config.inc