We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30269
    • 119 Posts
    We have multiple domains pointing to the same directory with Modx install. It would be great if each could have it’s own site_start so that they start in different page with possible different language/template. Helps our multilanguage / multi site environment...

    We would like to see:

    www.mydomain.com starts on page 1
    www.mydomain.nl starts on page id xx
    www.mydomain.fr starts on page yy

    or even

    www.sometohther.com to page zz


    etc.

    After many hours of playing around, we have not found a good way to do this. Does anybody have an idea?

    Help greatly appreciated:)
    Tom
      • 25663 MODX Staff
      • 12,272 Posts
      Wait for the glory of contexts in 1.0... Until then you could have each domain redirect to a specific page in MODx that is functionally a site-start for that language, and use Susan’s multi-language technique to manage the content.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 7923
        • 4,213 Posts
        Subsites/Subdomains plugin probably could be usefull untill contexts arrives


          "He can have a lollipop any time he wants to. That's what it means to be a programmer."
          • 30269
          • 119 Posts
          Thansk guys, both answers serve me very well... Doze for now, RT for future smiley
            • 30269
            • 119 Posts
            ... but now found a different solutions after I learned that the Subsites/Subdomains plugin was called on every page. It keeps chaning the site_start values every time a page is called. This slows things down. My idea is to redirect only once.

            So, what I did was:

            1. created a new file called: redirect.php
            <?php
            /* Redirect by TVld 15-09-2006*/
            
            $host=strtolower($_SERVER['HTTP_HOST']);
            switch ($host) {
                    case 'www.domainone.eu':
                    	header("HTTP/1.1 301 Moved Permanently");
                            header("Location: http://www.domainone.eu/index.php?id=57");
                            exit();
                    case 'www.domaintwo.fr':
                            header("HTTP/1.1 301 Moved Permanently");
                            header("Location: http://www.domaintwo.fr/index.php?id=89");
                            exit();
                    case 'www.domaintwo.com':
                            header("HTTP/1.1 301 Moved Permanently");
                            header("Location: http://www.domaintwo.com/index.php?id=212");
                            exit();
                    default:
                    		header("HTTP/1.1 301 Moved Permanently");
                            header("Location: index.php");
                            exit();
                    }
            ?>


            2. created a new index.htm containing just:
            <meta HTTP-EQUIV="REFRESH" content="0; url=redirect.php">


            3. and made a new .htaccess file:
            # make sure we load index.htm first and not index.php as per default. This allows for a redirect from index.htm before going to the database
            
            DirectoryIndex index.htm index.php


            So far so good and I now have a very easy to rewrite redirect.php script. Visitors keep seeing the url they called in the browser as all domains point to the same directory.

            Point of warning: I’m not familiar with friendly urls’ so don’t know if they still work and what the .htaccess should look liketo get them working!

            Tom