Moving Site To Another Location
From MODx Wiki
This tutorial is based on a typical scenario, which is developing on XAMPP locally (Win XP Pro) and deploying on a typical LAMP server environment. The same steps will work for any source server with little or no modification, unless to the .htaccess file or the method of accessing your database.
-
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]
Don't forget to rename the .htaccess file in the /manager folder to turn off the RewriteEngine for that folder.
- 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.
- 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)
- 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.
-
Unless you are in an environment where the webserver runs as the same username with which file ownership is attributed on the target server, you will need to change permissions on the following directories/files to 777:
- /assets/cache (and all files ending with .php in this directory)
- /assets/images
- /assets/files
- /assets/flash
- /assets/media
- 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.
- 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)
- Test the remote site. It should be working just the same as your local development site.
