We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25124
    • 54 Posts
    I have a site on www.domain1.com that is a php include site.

    I have rewritten this site in ModX wink (and I’m lovin’ it!) and have been testing and hosting on www.domain2.com, so as not to disturb anything on domain1.com.

    I want to move the ModX site to domain1.com to test before I make it live (as the server may be a little different and I can’t afford for domain1 to be down!) .

    So do I install the ModX site into a sub directory of domain1.com e.g. /modx and if so, how easy is it to make it the ’live’ site once I’m happy with the testing and ready to switch over?

    Sorry about this (probably basic question), but I can’t afford to make mistakes with this.

    Thanks in advance

      • 33372
      • 1,611 Posts
      If you don’t have an index.php file in your existing site (or any other files that might be overwritten, e.g. a "manager" directory), then you should be able to upload the MODx site to the root of www.domain1.com and test it with friendly URLs off. You should not upload the root .htaccess file either, of course. You can’t test URL rewriting this way, but everything else should work.

      You can also upload to a subdirectory and test it in there, in which case you can use friendly URLs also. The only downside to doing it that way is that you might want to move it all to the root later (to avoid having that folder name in your image links, etc.), and this can be disruptive and time-consuming. If you don’t mind the extra directory in your image and file URLs, then the easiest thing is often to just leave MODx in the subdirectory and modify your .htaccess file to redirect to the index.php file in there when you want to go live.

      I always choose a subdirectory name that I can live with permanently when I’m testing this way just in case I decide to leave the site there after launch (e.g., not something like "test-install" or "newsite").
        "Things are not what they appear to be; nor are they otherwise." - Buddha

        "Well, gee, Buddha - that wasn't very helpful..." - ZAP

        Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
        • 25124
        • 54 Posts
        That’s good advice, thanks. What I’ve done is created a "site" folder under public_html and managed to get it working in there.
        so what would I need to change in the public_html/.htaccess file in order to do the switchover. Do I just copy the .htaccess from /site folder and put it in the public_html/ folder? (seeing as it already has the correct rewrite rule intact?) - see here

        # The Friendly URLs part
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /site/index.php?q=$1 [L,QSA]

        And that’s it?

        Or am I missing some detail here?

        TIA


          • 25124
          • 54 Posts
          I just tried that for 2 seconds and it didn’t work (e.g. copied the .htaccess to the public_html directory). I must be missing something here then.
            • 36592
            • 970 Posts
            RewriteRule ^(.*)$ /site/index.php?q=$1 [L,QSA]

            I think you should change this line to ...

            RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
            

            You have to drop "/site" part.

            I hope this works for you.
              • 25124
              • 54 Posts
              Mmmm, even though the site is still in the /site directory?

              How does it know to call the files from the domain1.com/site rather than the domain1.com directory then?

              Sorry, probably missing something really simple here ....
                • 36592
                • 970 Posts
                Quote from: riteon at Nov 05, 2007, 05:05 AM

                Mmmm, even though the site is still in the /site directory?
                Ooops! Sorry... I thought you moved all files from /public_html/site to /public_html...
                  • 17883
                  • 1,039 Posts
                  Try this:

                  # The Friendly URLs part
                  RewriteEngine On
                  RewriteBase /ISB/
                  RewriteCond %{REQUEST_FILENAME} !-f
                  RewriteCond %{REQUEST_FILENAME} !-d
                  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]