We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30107
    • 44 Posts
    @worchyld

    I think this line:

    RewriteRule ^(index\.(html?|php)|domain1-com)?(.*)$ index.php?q=/domain1/$3 [L,QSA]


    has to be corrected to:

    RewriteRule ^(index\.(html?|php)|domain1-com)?(.*)$ index.php?q=/domain1-com/$3 [L,QSA]


    Hope this helps
      • 32645
      • 377 Posts
      @titanium -- Thanks but my htaccess already does this:

      RewriteRule ^(index\.(html?|php)|travel2spain-co-uk)?(.*)$ index.php?q=/travel2spain-co-uk/$3 [L,QSA]
      


      I just need to prevent access to child items via the top level domain.

      IE:
      The following needs to produce a 404 error, currently it does not do this.

      http://www.somedomain.co.uk/travel2spain-co-uk/some-child-page/... (etc)

        • 32645
        • 377 Posts
        I think I have a solution but need a htaccess guy to double check.

        After following:


        http://ask.metafilter.com/21254/RewriteRule-and-Trailing-Slashes

        I think the problem was the rewriting to each domain.

        I have changed it to the following:

        # rewrite the homepage of each domain to index.html
        RewriteRule ^travel2spain-co-uk/?(.*)$ /index.html [L]
        


        I have tested it, The idea is:

        1. To stop people going to somedomain.co.uk/travel2spain-co-uk/ regardless of whether there is a trailing slash.

        I think there is a bug in the tutorial as you get different results if you do or do not put a trailing slash.

        2. I also want to stop any child items getting through, such as:

        somedomain.co.uk/travel2spain-co-uk/some-child/

        And the above line seems to sort it out.

        Can someone please clarify if the above is indeed correct and htaccess valid.

        Should I be putting a [L] at this point or not? It will give me 500 errors if I do not.

        Thanks.




          • 16474
          • 5 Posts
          Late reply, but I’m wondering why you want to redirect them to the index page regardless of which child item they’re on. What you’re doing will work, but I think it makes more sense to do:
          RewriteRule ^travel2spain-co-uk/?(.*)$ /$1 [R=301,L]

          That way, it will bring them to whatever page they were trying to access using the full path. Also, some add-ons might use the full path of pages in some instances, so you’ll get unexpected behavior if you’re always sending to the index.
            • 32645
            • 377 Posts
            The website appears to be working, but I’ll keep a note of your recommendation just in case!
              • 27660
              • 3 Posts
              This is a great script/solution.

              I had only one problem, and that was when you type only the domain name, lets say:
              http://example.com or
              www.example2.com
              example3.com

              You allways end up in the startpage of modx (configuration -> start site).

              Based on the 404 plugin I created this solution, which works perfectly for me.

              I created a start page and put a snippet in "[[startSelect]]", this is the modx startpage (non cached).

              The snippet contains the following code:
              /*####
              #
              #   Name: Homepage select and Redirect for multisite
              #   Version: 0.1
              #   Author: Marcel Bouwmeester
              #
              ####*/
              global $modx;
              $table= $modx->getFullTableName('site_content');
              $host_url = $_SERVER['HTTP_HOST'];
              $host_url = $modx->db->escape($host_url);
              $where = 'pagetitle = "'.$host_url.'"' . ' and parent="0"';
              $result = $modx->db->select('id',$table,$where);
              $row = $modx->db->getRow($result);
              $home = $row['id'];
              if ($home){
                $this->sendForward($home);
              } 
              return "";
              


              Based on the hostname it looks for a page with the title "domainname" in only the root documents.

              the root should like like this (pagetitles)
              - startpage (non cached)
              - www.example.com
              -- (sub pages)
              - www.example2.com
              -- (sub pages)
              - www.example3.com
              -- (sub pages)

                • 7455
                • 2,204 Posts
                I would like to have one folder outside the domains that contains my css files

                but it does not work I think because the url is rewitten?

                i like to have

                |-www.domain1.tld
                |----home.html
                |-www.domain2.tld
                |----home.html
                |-css
                |----basic.css
                |----typo.css

                how would I do this?
                even if I put the css in domain1 folder and call it in the link tank for css like [~id~] it does not work.

                and another thing the index.php?id=# does not work anymore
                  follow me on twitter: @dimmy01
                  • 7455
                  • 2,204 Posts
                  I found another problem in my site:
                  how do i define a startpage for each domain
                  on each domain they go to the same start id(page) that is defined in the configuration.

                  Dimmy
                    follow me on twitter: @dimmy01
                    • 30741
                    • 65 Posts
                    Here is an interesting issue - So far we have a website setup with 10 DOMAINS... Really that’s what the client wanted, but now I need to clean up some old links to point from a subfolder to the site install but when I do a Redirect it doesn’t change over cleanly. any ideas?
                    Here is the resulting url with a redirect:
                    http://www.mydomainB.com/?q=/mydomainA-com/domainB/index.html

                    So Instead of with a redirect from domainA.com/domainB/index to http://domainb.com it ends up in confusion with the long thread above.
                    Any thoughts on a solution ?
                      • 5046
                      • 1 Posts
                      Hi there,

                      I am new with modex and my requirement is to manage 8 sites through single admin so i found modex will solve my problem.
                      But i am facing an issue while installation.

                      I downloaded modx-2.0.3-pl-advanced.zip file , but i am not getting an option which you mentioned in this link
                      http://www.modxcms.de/multiple-domains-with-modx.html

                      Please tell me the complete procedure and correct modex version for an installation.

                      Your response is more valuable for me. Guys please help me.