How to Move an ExpressionEngine Website from One Server to Another
Sometimes clients want to move their ExpressionEngine website from one server to another. Perhaps they’re changing webhosts, or perhaps they want a working backup for development purposes. This post is a guide for how to backup and move your ExpressionEngine-powered website. It is a guide for EE 1.6.x
In order to move an ExpressionEngine website, we need to transfer two things:
- The Files
- The Database
Transferring Files
This can be done using your favorite FTP program. There are many free FTP programs out there, for Windows I recommend WinSCP, and for Mac I recommend Cyberduck. Because I am a web developer by trade, I forked over a reasonable $28 for Yummy FTP on the mac, a fast, robust, and easy-to-use FTP client.
Now that you have your FTP client of choice, you need to create a new connection to the existing website’s server, and view all of the files for the site. If your FTP client has a sync feature (Yummy does), then you can simply create a new folder on your desktop and synchronize all of the files from the site to that folder. If there is no sync feature, just drag and drop all of the files into that folder. Make sure that your client doesn’t delete the originals on the server, but just copies them. This is probably the default behavior, but just had to mention that.

You should now have a local copy of the files that drive the site. You can pretty much just reverse these directions to upload the files back up to the new server environment. These files include the engine behind the site, as well as the images. Depending on how the site is set up, it might include the template files as well, but by default those are stored within the database. In fact, you don’t have much of a site without that database, and unfortunately, it can be the most difficult item to successfully transfer.
Transferring the Database
Databases can be imported and exported into a .sql file, making transfer of this data seemingly simple. Sometimes, it is painless, but sometimes, it can take hours to troubleshoot. My advice is to Google any errors that you receive and hopefully you can find a solution in a forum somewhere. That is how I have successfully forged through a couple of hurdles in this department.
If you have access to phpMyAdmin on both servers, then great. You can generally click on the database name, click on the export tab, and export the database into an SQL file. The following is a great tutorial on how to do that:
If you don’t have access to phpMyAdmin, there is a little trick that you can do via FTP to grab that .sql file in a method known as the “SQL Dump”. I have written a little script that you can place within a folder on the original site, and navigate to that page. For example, I could create a folder called “sqlbackup”, and within create an index.php file. I would paste the code below into that index.php file, and then navigate to www.sitename.com/sqlbackup/index.php, and I would then run the script.
Note: the settings for the below script can be found by navigating via FTP into system/config.php
<?
//setup the variables, replace the all-caps words below
$conf = array();
$dbhost = "DATABASE HOST";
$dbuser = "DATABASE USER";
$dbpass = "DATABASE USER PASSWORD";
$dbname = "DATABASE NAME";
//check the connection
$link = mysql_connect($dbhost,$dbuser,$dbpass);
if (!$link) { die('<p>Could not connect to MySQL: ' . mysql_error() . '</p>');
} echo '<p>MySQL Connection OK</p>'; mysql_close($link);
//backup the database
$backupfile = 'Backup-' . date("Y-m-d-g-i-s") . '.sql';
$backupzip = $backupfile . '.tar.gz';
system("mysqldump -h $dbhost -u $dbuser -p$dbpass $dbname > $backupfile");
echo "<p>Files Have Been Backed Up Successfully</p>";
?>
This script will generate an .sql file in the same directory as the index.php file, so in my example, the sqlbackup folder. Via ftp, you can drag that file to your desktop, and then delete it from the server for security reasons. This file could be navigated to and downloaded by anyone, providing all of your site’s guts (probably not a good idea).
At this point, you should have an .sql file by one of those two methods, and you will need phpMyAdmin access in order to upload this database into the new location. For this, you login to phpMyAdmin, click on the name of the database you are importing into, and click on the import tab (If you haven’t already, you’ll need to setup a database using whatever database wizard is in your hosting control panel, or simply use phpMyAdmin—instructions here). From there you will select the file on your local machine, and import. If there were a reason for an error, this would be it. Remember, just Google the error with the word ExpressionEngine and see what comes up.
Final Steps
The final things that you need to do in order to make sure that everything works correctly is to set the path to the database, and change settings within the control panel to reflect the new site structure.
To set the path to the database, navigate via FTP to the config.php file within the system directory. You need to enter the new database settings into those fields.
To change settings within the control panel, you need to browse to the control panel in the new server environment. You will probably have no stylesheet associated with the backend, so don’t be alarmed if everything looks wonky. Find your way through the unstyled control panel to Admin > System Preferences > General Configuration. Here you can begin to set some of the preliminary paths in the new server environment. Once this is done, there are many other obscure paths hidden throughout the system control panel that need to be changed. Save yourself some time and grab Hop Studio’s excellent Deeploy Helper Module, which lists all of the settings on one page. To make things easier, is a quick find/replace feature is included.
Conclusion
This is really all that it takes to migrate a site. Generally I estimate to my clients that this process will take 4 hours. Depending on the hurdles discovered, this has been about accurate. A majority of the time is spent uploading and downloading items, not to mention finding all of the appropriate login information. The more organized you are about this, the less likely you will be to really mess things up. These instructions can also be followed to simply make a backup copy of a website on your local machine using something like MAMP for Mac, or WAMP Server for Windows (both free).
Happy Migrating!




Comments (3)
Jordan
Oct. 18, 2010
Thank you for posting this one , I haven’t thought I can make this things easier as they posted also with their helpful tutorial video. They are just totally easy as a starter of this all blog. It is very crystal clear how to move my own expression engine website to another.
salmanehsaan
Sep. 06, 2011
It's a nice thing to read your blog post. Its content is powerful and straight to the point. Good Job!
http://efolusi.com/
Dominique Lorrena
Sep. 16, 2011
it's good to see this information in your post,I loved your blog.Your tips are very helpful.http://efolusi.com/
Join the Discussion