MODX Evolution to Revolution from Subfolder
Now that you've developed your MODX Revolution site in a dev folder (subfolder), the time will come to move this site to the root on your server.
The MODX RTFM has all the information you need, however the step by step is not included in the documentation, so here you go. We are going to assume that you are following recommended procedure and working in the file manager of your site. This is not for FTP uploads, and no garuntees are given if you choose to work with FTP to make the file changes to your website.
All activity should be performed in the site's file manager due to FTP's history of corrupted file uploads. The only safe way to move your site is through your hosting's file manager. In most cases this is cPanel, and the following information allows for safe site movement within that file manager.
- BACKUP all your site files. This includes database files for both the MODX Evolution site's database, as well as the database for your current site. Assuming you have a new database for your MODX Revolution site, this is fairly seamless for moving to the root of your server and disabling your MODX Evolution site. Also backup your site files themselves, which primarily will include your assets/ directory.
- Once your site files are verified as backed up, proceed to disable the MODX Evolution site, and enable the MODX Revolution site on your server.
- In your control panel's file manager, rename the MODX Evolution folders with a new name, let's work with "filenameOld" as a new filename. For example, rename the "assets" folder to "assetsOld". Rename the "manager" folder, to "managerOld". You will need to rename all Evolution folders to "newName" prior to moving your Revolution site to the root. Once you rename the folders, the site is officially "down", for the time being. Until you configure the new site and copy it to the root folder, the visible site is "down".
- Once your old Evolution folders are renamed, you can safely copy the contents of your subfolder into the root of the site. Enter the subfolder, copy all contents into the root of the site.
- Navigate to the 4 configuration files that were allowing you to develop in a subfolder. They now all need to be changed to omit the subfolder name, and connect to the default MODX paths.
MODX - Moving your site to a new server or from subfolder to root
Updating your Config Files
Once you've deployed files to the new server, you need to update the main configuration file: core/config/config.inc.php. You have to update paths to 6 different resources. Open the file and update the values for the following variables doing a find and replace:
/* PATHS */
/* HOST (used for command-line PHP stuff) */
If you are also moving your site into or out of a subfolder, be sure to update the variables such as $modx_connectors_url, $modx_manager_url, and $modx_base_url. They should generally
end with a slash (e.g., $modx_base_url='/' for a site not in a subfolder).
Before you can edit your config file, you may need to loosen up the permissions. After you've edited it, be sure you restore the read-only permissions on the file.
There are also 3 additional configuration files that contain two PHP constants:
Make sure you update the paths in these files as well.
*If you are working with a ~temporary folder on your server, the url for development is often preceded with a ~yoursitehome addition in the path. The configuration files noted above will include this temporary path on the development installation. Make sure to check all the above 4 files for this temporary path and change to the above settings for production root installs.
- After changing your site's configuration files, navigate to the core/cache folder, select all the files within and delete them.
- Once you have updated your configuration files, you will need to perform a reinstall of MODX. This is simple, but crucial to your site's success. Upload a .zip copy of your site's version of MODX to the server (public_html). In your file manager, extract the contents into their own subfolder. This is often automatic. Open the newly created subfolder, and highlight all the contents. Right click, and select copy. Alter the path so that the copied contents are directly merged with your public_html contents, and select ok. If your old filenames are renamed, this will not affect your old Evolution site's files in any way.
- Once your new site files are on the server, navigate to http:yoursite.com/setup and select or verify that the site is to be updated (not overwritten). Navigate through the setup process, and log into your site.