We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5532
    • 251 Posts
    Hi There,

    We’re 3/4 of the way through our first Modx site and would now like to move the local development site to the final hosting server for testing (and implementing friendly URLs etc).

    How exactly do you do this without having to recreate the site and database tables etc? We didn’t have much luck searching for info on this.

    Any help would be appreciated.

    Cheers

      • 3749
      • 24,544 Posts
        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
        • 5532
        • 251 Posts
        Thanks Bob,

        Very new to all this - does it matter that we didn’t edit the .htaccess file before we created the local site!

        Also, having trouble changing the name to .htaccess as by default OSX doesn’t allow a "." as the start of a file name.

        Cheers

        Ben
          • 4310
          • 2,310 Posts
          There are quite a few OSX tweaks / tools to show hidden files, Google is your friend.
          You should be able to rename it using your FTP program.
            • 5532
            • 251 Posts
            Thanks for the reply, but after reviewing the info on the Wiki several times, I’ve come to realise that I don’t understand most of what is suggested.

            As painful as it is, I guess I’ll have to start again.
              • 3749
              • 24,544 Posts
              Quote from: cms at Apr 27, 2009, 10:55 PM

              Thanks Bob,

              Very new to all this - does it matter that we didn’t edit the .htaccess file before we created the local site!

              Also, having trouble changing the name to .htaccess as by default OSX doesn’t allow a "." as the start of a file name.

              Cheers

              Ben

              The .htaccess file is only necessary if you use Friendly URLs. Actually, when moving to a new server, I’d recommend having FURLS turned off and leaving the file as ht.access until you have a successful install, then start messing with FURLS if you want them.

              Windwows chokes on the "." also so I usually use "save as" in a text editor to add the initial period.

              Instead of starting over, how about telling us what you don’t understand in the Wiki article -- we can help you and maybe improve the Wiki article at the same time. There are also some pages at the site in my sig that might help too.
                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
                • 5532
                • 251 Posts
                Thanks Bob, we really appreciate your offer to help us out - very kind.

                Here are the things we’re not sure about (pretty much all of it sorry!) - assuming we didn’t modify the ht.access file during local development.

                1.

                Install the site locally, renaming and editing the .htaccess file to indicate the subdirectory you are deploying your site into in the test environment, as in the following example with a local development copy of the MODx CMS site at /localhost/modxcms/:
                 RewriteEngine On
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                # If your MODx installation is in a subdirectory, change the following line to
                # match the physical path to the "root" of the site as follows:
                # RewriteRule ^(.*)$ /path/to/subdirectory/index.php?q=$1 [L,QSA]
                RewriteRule ^(.*)$ /modxcms/index.php?q=$1 [L,QSA]
                
                For some reason our Modx site doesn’t have an ht.access file in the root directory (have also checked in Terminal incase it was a OSX GUI thing). We do have one inside the /manager directory but it looks different to the example in the Wiki:
                RewriteEngine Off
                <IfModule mod_security.c>
                # Turn the filtering engine Off
                SecFilterEngine Off
                </IfModule>


                2.

                After developing the site locally (using all relative paths from the site root, to keep it portable), make a copy of .htaccess and call it .htaccess.local, editing the path on the .htaccess file for the remote deployment location as appropriate (usually removing the subdirectory path). The .htaccess file in /manager should be left as it is.
                Not sure what "edit the remote deployment location as appropriate" specifically means we should change our file to be - plus we don’t have any subdirectory in our htaccess file because of the reason above.

                3.
                Then make a copy of manager/includes/config.inc.php as config.local.inc.php, and edit config.inc.php with the remote database connection settings for the deployment server (the remote db must be already created and ready to use)
                This makes sense - essentially this file gives Modx access to the MySQL database on the hosting server and you have to have a database already set up - presumably giving the host database the same name as the local one?

                4.
                Copy the /manager, /assets, /index.php, and /.htaccess folders and files to the target LAMP server (you can optionally exclude *.local.*). If this is an upgrade and not a new installation, make sure to save your remote site’s /assets folder first, then you can re-upload all of your existing content, such as images and templates, if the upload has overwritten any of it.
                Not sure what a LAMP server is - is that MAMP but with an L for Linux maybe? Also, not sure why you only copy those files - wouldn’t I want to copy everything like my flash banners and xml folder etc?

                6.
                Dump the local DB contents (use the Backup Manger, or any MySQL client such as phpMyAdmin) and then execute the SQL dump in the target DB on the remote LAMP server (most hosting environments use phpMyAdmin for this). You will probably want to empty any log tables before backing them up, or else you’ll have rows and rows of log data useless to your new server.
                Not sure what "Dump" means and don’t really understand what is being said here. We’re guessing this is how you copy the tables out of the local database? We can’t find the "Backup Manager" in phpMyAdmin (have searched their wiki as well) but we can see import and export tabs under our database (both locally and on the remote host) - can we not use these? We’re assuming the Backup Manager will create a file that we import into our LAMP server - is this what "execute the SQL dump in the target DB" means? Also, not sure about the log tables but maybe this is all self-evident?

                7.
                Access the remote manager’s Adminstration -> System configuration and change the paths for the resource browser (Resource Path and Resource URL in System Settings -> Interface & Editor Settings tab) and the filemanager (File Manager Path at System Settings -> Miscellaneous Settings tab)
                Again, can’t quite figure out where this is. We’ve chosen (mt) as our host (unless people have a better recommendation) and can’t figure out where this might be - have dug around the (mt) control panel as well as phpMyAdmin but can’t see Resource Path or File Manager Path. Also, once we find it, what do we change the paths to or maybe this is self evident?

                Sorry we didn’t really understand any of what was written in the Wiki.


                  • 15175
                  • 116 Posts
                  Hi CMS.

                  I’m pretty new to MODx as well, but I’ve managed to transfer a couple of sites from WAMP on my computer to my hosting. Here’s what I’ve been doing it’s any help:

                  1/ Create a new database for MODx on my hosting and add a user.
                  2/ Export the current development WAMP MODx database using PHPMyAdmin (make sure that "Save as File" is checked) - this will then save that database in your browser’s designated download directory.
                  3/ In PHPMyAdmin on my hosting, select the created MODx database from 1/ and import the database you just exported.
                  4/ Edit the MODx config file (manager > includes > config.inc.php ) with the necessary database details - probably a good idea to make a copy of this first, just in case.
                  5/ FTP the site up to the hosting .
                  6/ Login into the MODx manager and update the necessary paths:

                  Tools > Configuration > Interface & Features > Resource path
                  Tools > Configuration > Interface & Features > Resource URL
                  Tools > Configuration > File Manager > File Manager Path

                  7/ Turn on friendly URLs:

                  - Using the FTP program, change the file the file name of ht.access to .htaccess - I haven’t needed to edit the contents.
                  - In the manager Tools > Configuration > Friendly URLs > select yes > spend half an hour searching through the forums on why friendly URLs aren’t working properly > curse > realize that you actually haven’t specified the aliases when creating the documents > slap forehead.



                  I think that’s all.
                    • 9207 ☆ A M B ☆
                    • 2,475 Posts
                    cms -- I hope you’re able to figure this stuff out. It’s a pain if you don’t understand the ins/outs of Apache and MySQL. It’d be a shame if you re-created everything from scratch on the new server when all you need to do is transfer the files and the database to the new server. I do this almost daily as I work on a dev server then transfer files over to a production machine. Message me if you want me to look into this for you.
                      • 5532
                      • 251 Posts
                      Thanks guys, this is a steep hill to clime but I think I’m getting there.

                      @j_p
                      Your instructions are a lot easier to follow than the Wiki and I’ve made good progress, but I’ve come across an issue in step 3. All databases on my host have to include a prefix in the database name which means the name won’t match my local database - and I get an error when I try to import my local sql database to the host.

                      I was hoping I cold just rename my local database then re-export, but when I try to rename the local database, I get a warning which makes me think I’m going to lose all my Data...
                      Do you really want to: CREATE DATABASE ... and then DROP DATABASE `localdatabasename`
                      I realise what the error is saying, I just want to double check that all the tables will be transferred to the new name and that my local Modx installation will still work? When looking on the phpMyAdmin wiki it does state there is a bug:
                      bug #1755339 Warn about rename dataase actually being copy/delete
                      But I’m still unclear as to what’s actually going to happen in Modx if I rename it - can I just change the settings in the config.inc.php file to the new name if I have to?