We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51816
    • 4 Posts
    Hello

    I have a Revo 2.3 installation with four domains company1.com, company1.org, company2.com, company2.org.
    The apache vHost has domain1.com as serveraddress and the others (also with www) als aliases.
    The domains *.org rewrite to *.com.

    The only differences between company1.* and company2.* are some css colors and the logos.
    I read the URL with [[!++site_url]] and $modx->getOption('site_url') and like to control the "branded" output by chunks.
    All calls are uncached.

    The problem is that site_url does not changing correctly. When I switch from company1.com to company2.com and back it works. When I switch two times between company1 and company2 it stops working. While the browser address is company1.com, the HTTP header and HTTP_HOST stay on company2.com (or opposite). So the browser address gets ignored after this.

    Maybe a problem(?): When I switch between the domains I see the google analytics cookie behind the domain like domain1.com?__ga...


    What could be the problem? An open connection / cookie?
    Is it possible to do some color and logo changes this way? I think two contexts or two vHosts for only this is too much.


    Thanks a lot for helping.
    Martin
      • 9674
      • 170 Posts
      Martin,

      We have one site with exactly the same problem.
      We have multiple aliases running on the same domain hosting, and site url seems to be almost anything changing all the time (even for pop or smtp.domain.tld

      In our case, we want to fix on one domain, but symptom is the same.

      So if you find a solution, let us know.

      Philippe
        • 51816
        • 4 Posts
        Philipp

        As workaround I rewrite all domains to the main domain. But this not a solution.
        Do you see also this google analytics path behind the url in the browser bar when you switch?


        Martin
          • 29059
          • 88 Posts
          i too am interested in finding this solution.

          for me, suddenly today the "site_url" started changing randomly between my various domain aliases - which started causing issues with fonts & library CDN's i'm linking to. so far the only temporary solution i've found is to manually (via ftp) delete all the cache folders in the core/caches/ directory.

          but i do have future plans/desires to have a landing page for each of these other domain aliases. haven't quite figured out how to manage this yet.

          so i'll be keeping an eye out here & elsewhere - will share if i find anything.
            • 46886
            • 1,154 Posts
            This thread should not be answered, op
            • Are you using different contexts for each one?
                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
                • 13226
                • 953 Posts
                Just for information: As the post has not been answered I have removed the answer flag.
                  • 29059
                  • 88 Posts
                  Oops... i may have just done a no-no (SORRY!!!)...

                  i found another thread a bit ago & replied to it. it's on this same issue...
                  https://forums.modx.com/thread/85230/incorrect-tld-appearing-in-base-url#dis-post-539730
                    • 51816
                    • 4 Posts
                    I used the same context for each alias. After change from one alias to an other and back site_url didn't change back and stayed on the second alias. On http level the url changed but site_url ignored it.

                    Now I am using only one domain and rewrite all aliases to it.

                      • 41255
                      • 19 Posts
                      Create a Plugin with System Event 'OnWebPageInit'.

                      $getHost=$modx->getOption('http_host');
                      switch ($getHost) {
                          case 'www.company1.com':
                              $modx->setPlaceholder('+site_url', 'http://www.company1.com/');
                              break;
                          case 'www.company2.com':
                              $modx->setPlaceholder('+site_url', 'http://www.company2.com/');
                              break;
                      }