We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30711
    • 70 Posts
    I’ve been doing a lot of searching, but haven’t found a simple solution. Maybe I don’t know what I’m actually looking for..

    I have a old website with no MODx installed. I want to change this site to use MODx. I want to install MODx and keep the old site running while setting the new MODx site up. What is the best way to do this? I could install MODx to a subfolder, but if I understood correctly that would make my url to be www.examplesite.com/modx ? After this is changes in the .htaccess the way to go or should i do something completely different?

    Tommy
      • 3749
      • 24,544 Posts
      There are a number of ways to do what you want. The first thing to do is back up the remote site. Then, I usually follow these steps:

      • Install MODx locally under XAMPP.
      • Port the site into it -- leaving the remote site untouched (see "porting your site to MODx" at the site in my sig).
      • Get the local MODx version of the site the way you want it.
      • Back up the remote index.php or index.html file (if any).
      • Install MODx on the remote site (leaving the original site there -- the only thing MODx will touch is the index.php file).
      • Once the MODx install is successful, copy the local install to the remote MODx installation and delete the original index.html if any.
      • If the site is working fine under MODx, carefully delete the original html/php files.

      • If not, restore the backed up index.php (or index.html) file and the original site is back up.
      If the original site has /image /css or /file directories, you can reuse them in the MODx site, or create new ones in the MODx site that don’t conflict.
      If the original has stuff in the database, you’ll need to either have the MODx version of the site use that other DB or (what I usually do) port the data into extra tables in the MODx DB once it exists.

      Hope this makes sense.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 30711
        • 70 Posts
        Thank you! But what if I want to go on-line right away and don’t want to do it locally? I want to setup the new site on the remote site while old site is still running. This would allow other users to edit content at the same time.

        Tommy
          • 3749
          • 24,544 Posts
          I haven’t tried this, but I think if you install the MODx site and then restore the old site’s index.php or index.html file after renaming the MODx index.php to index.php.modx, you should still be able to access the MODx Manager to add and edit content. You won’t be able to preview the MODx site, though. Activating the MODx site would then just be a matter of renaming index.php.modx to index.php.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 27708 MODX Staff
            • 2,502 Posts
            Another option would be to insert the contents index.html or index.php contents into a new document in your new modx install with the template set to blank and make it the site unavailable page. Leave all your other pages intact and you should be good.

            What I normally do is install and set up in a subfolder like /siteroot/dev and then when ready to launch migrate the files back to root and change the path settings in the manager for the file manager and resource paths.

            Be sure to back up your entire working site to a local computer before attempting any of the above methods and addtionally it isn’t bad to have an archive folder on your server too if you break your site moving files is far faster than re-uploading them.

            Cheers,

            Jay
              Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
              • 6955 ☆ A M B ☆
              • 147 Posts
              Quote from: smashingred at May 17, 2009, 02:28 PM

              Another option would be to insert the contents index.html or index.php contents into a new document in your new modx install with the template set to blank and make it the site unavailable page. Leave all your other pages intact and you should be good.

              What I normally do is install and set up in a subfolder like /siteroot/dev and then when ready to launch migrate the files back to root and change the path settings in the manager for the file manager and resource paths.

              Be sure to back up your entire working site to a local computer before attempting any of the above methods and addtionally it isn’t bad to have an archive folder on your server too if you break your site moving files is far faster than re-uploading them.

              Cheers,

              Jay


              So basically install modx - copy whats on my index.html to a "blank" template for MODX and leave everything else. Then start creating new info thru modx once that is completed remove the old info. Correct?
                Billy Koch
                Follow me on Twitter: @DefKoch
                Skype: billyk0ch
                • 27708 MODX Staff
                • 2,502 Posts
                Not to a blank template but to a new document (edit the Install Success document) using a blank template make the alias index and and then in Tools->Configuration->Site change the Site unavailable page to the id of your new document and turn your site status to off. Make sure you have friendly URLs enabled so the links to your index.html will work.

                  Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
                  • 30711
                  • 70 Posts
                  Thanks for all the help. Before trying any of the above I had a chance to experiment with one site. I installed MODx to root while old site was running. Old site is just XHTML+CSS.

                  After installation www.example.com showed contents of index.php which was the installation success page from MODx.

                  I renamed index.php to index.php.new and the old .html site started to work again, no problems. I still can log to /manager and edit and preview my new MODx site at www.example.com/index.php.new

                  My menu on the new site doesn’t work, but if I can test other pages typing www.example.com/index.php.new?id=2 for example.

                  Is there something I’m missing here? It looks pretty straight forward to me and no friendly URLs or other stuff. When I want to start to run the new site I just rename index.php.new back to index.php and delete all the old content. Right?

                  Thanks,
                  Tommy
                    • 3749
                    • 24,544 Posts
                    That sounds right. You’ll almost certainly want to use Wayfinder for the menu on the MODx site.
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 12379
                      • 460 Posts
                      I created a snippet called RestrictAccess and added it to the top of all the templates, uncached:

                      [!RestrictAccess!]:
                      <?php
                      if (!($mgrUserId = $modx->getLoginUserID('mgr'))) {
                          $modx->sendUnauthorizedPage();
                      }
                      ?>


                      Then I created a page called "Unauthorised Access", used the "Blank" template and pasted in some temporary html formatting. In Tools/Configuration use this page id for the "Unauthorised Access" field.

                      So long as you are logged into the Manager you can view your site but the public can’t. If they stray upon one of your new pages accidentally they’ll be redirect to the Unauthorised Access page instead.

                      Alternatively, you could set the snippet to redirect to the home page, skipping the "Unauthorised Access" instructions.

                      When you’re ready to roll simply delete the snippet from your templates and move your old web site code into another folder for backup grin
                        Mostly harmless.