January 30, 2004
Moving your MT Blogs to a New Server or Web Host
Moving your Movable Type blog to a new server or to a new host is much more perilous than you might think. If not done properly, you could lose all of your entries. I recently went through this exercise and what saved me was a set of instructions from MT user Russcam. What I've done here is reworked Russcam's instructions for what worked for me with moving a site with multiple MT blogs. In some cases in this document I copy his words, word for word. I may get skewered for plagarism here, but I hate PDFs and need a web-findable record of what I did. This is essentially Russ's work, with my tweeks and ammendments. Please leave comments, questions, or proposed amendments in the comments field. I'm not a techie, so if something goes wrong by following these instructions, I can't help you. I accept no liability. Read Russcam's notes as well and do your homework before attempting a move.
This tutorial is for those who already have an MT blog or blogs installed and are moving to a new server or to a new web host.
BEFORE YOU BEGIN
Before beginning the process, if you are transferring your domain name to a new host, wait until you have your MT blogs running smoothly at the new host. Your new host should be able to provide you with an IP address you can use before you make your domain name point there.
Note: If you are using Berkeley DB, you may encounter problems migrating your blog(s). I recommend upgrading to MySQL before you move hosts, in order to avoid the problems encountered with Berkeley DB. I used Berkeley DB and could not get into my blogs after a server upgrade. I followed MT's troubleshooting advice, but it didn't help me. I ultimately had to pay Six Apart for an install just to get the new one working again. But if I hadn't paid attention to these following steps, I wouldn't have had a blog to reinstall.
Note: if you are using MySQL as your database, in lieu of the following steps you can use a MySQL dump command to back-up your MT database with all of your entries, templates, and configuration preferences. You will need to back up any images used in your entries separately. See Backing Up Your Blog. You will need to know how to repopulate your new MySQL database on the new server with the dump file of your old database. Many web hosts provide a CPanel or phpMyAdmin that can make this easy.
1) BACKUP YOUR TEMPLATES
Using an FTP client, create a templates folder in the same directory of the index file of each of your blogs. In MT Weblog Edit, for each blog that you have, go to the manage templates section. Template by template, create a backup template by inserting a file name into the Link this template to a file window. For example, for your main index template, type in templates/mainindex.tmpl. Rebuild your files. This tip comes from MT supermoderator Girlie and can be found in detail at http://www.thegirliematters.com/tips/archives/0207/back_up_templates_with_link_this_template.php.
2) RECORD CURRENT PREFERENCES
In MT, click the "Weblog Config" button in the left-hand menu and for Core Setup, Preferences, Archiving and IP Banning, record your current settings by printing them out. Some printers don't fill out the check boxes when printing, so check your check boxes on your printouts for future reference.
3) CREATE BACK UP FOLDERS ON YOUR CLIENT
If you have several blogs like I do, you'll need to keep track of the back up files for all of your blogs. The best way to do that is to create separate back up folders for each blog on your local computer (client).
4) EXPORT YOUR BLOG
For each of your blogs, in MT Weblog Edit, click "Import/Export" from the menu at the left. If you are on a Mac, hold down the "option" key or if you are on a PC hold the shift key. Next (while holding the option or shift) click the link, "Export Entries From yourBlogName" and you can save the export. The resulting file should be called mt.txt, if it shows up as "mt.cfg" don't worry - just change it to mt.txt. For each of your blogs, put the mt.txt file into a separate folder on your client for use later. Check each file and make sure the export worked and you have a text file with the data from all of your entries.
5) RETRIEVE CURRENT HTML
Here you will download from your current server (the visitor accessible html, etc) the complete directory where your blog resides. Using an ftp program, download the directory (folder) that encloses your blog.
Once you have downloaded the directories, for each archives folder, delete the entries or move them someplace else, out of these particular back up files. You will be repopulating these folders with data that you just got from you export when you import them back later.
6) GET YOUR CURRENT mt.cfg FILE
If you don't already have a copy of this configuration file on hand, retrieve it from your current server. It resides with the MovableType application (for many people this is in the cgi-bin directory).
7) COPY YOUR PLUGINS FOLDER
If you are using any of the various plugins available for Movable Type, make a copy of those plugins from your plugins folder in your CGI bin to your client to reload later. Also retrieve and copy any plugin related files from your exlib directory.
8) SET UP NEW DATABASE FILE AT NEW HOST
Some hosts require you to contact them to get your database set up. Usually you tell them the username and password you want and they respond with the database name (it varies, check with your host). Other hosts allow you to set up your database via their user control panel.
9) UPLOAD BLOG DIRECTORIES TO NEW HOST SERVER
Upload the directories you saved from Step 5 to the new server. To simplify things, try to maintain the same paths as you had in your old webspace.
10) INSTALL MT TO NEW SERVER
Install the MT application. Do not just copy your MT files from your old server, it may not work if you do that. Get the latest copy of MT from MovableType.org and install MT from scratch. Run the diagnostics and checks. Don't forget to place the mt-static directory in the public html space if that is where you had it before.
11) PLACE EXPORTED BLOG WHERE MT CAN FIND IT
Chose which blog you will import first. In the same directory where the mt.cgi file resides, create a new directory called, "import" and place the blog's mt.txt export file you created in step 4 inside.
12) EDIT mt.cfg TO REFLECT INFORMATION FOR NEW HOST
Pay special attention to any settings that may have to change because paths for certain things are different in your new webspace such as CGIpath, ObjectDriver, Database, DBUser, MailTransfer, SMTPServer and StaticWebPath. Pay careful attention to CGIpath if your new host has a different location for cgi-bin.
13) PREPARE NEW BLOG
Connect to MT at your new webspace and create a new weblog. Using your Weblog Config print outs from Step 2 of the blog you want to set up first, re-enter these settings. Enter your Archiving settings before the Preferences settings so that your Preferred Archive Type shows up in the pull-down menu in Preferences. Also, unless you set the Default Post Status to "Publish", all your imported entries will come in as drafts. You can change it back to "Draft" after you complete the import.
14) UPDATE TEMPLATES
If you followed steps 1, 5, and 9, your template files should be already in your blog directories on your new server. For each template in your blog, relink a blank template to each one. To do this, type the path of the template file into the Link template to file window. Make sure that the template body window is blank. Click save and MT will populate the template body window with the data from your existing template file.
15) IMPORT BLOG
Before importing, be sure to read over the MT documentation on the subject, particularly regarding assigning authorship and categories. When you are ready, in MT click Import/Export in the left-hand menu then click the "Import Entries" button. When the import is complete, click REBUILD. View your site.
16) REPEAT STEPS FOR ALL YOUR BLOGS
For each additional blog, click create new weblog in the Main Menu of the Weblog Edit page. Repeat steps 10 through 14 for each blog of your website.
17) POST A NOTE ON THE BLOG AT YOUR OLD HOST
Create an entry that basically tells your readership that you are making the move and that it may take a day or two for the DNS servers to connect your domain name up to the new host. Ask them not to post comments during this period or they may be lost.
18) RE-DIRECT DOMAIN NAME (skip if you don't have your own domain name)
This process will depend on who you registered your domain name with. If you don't know how, contact your domain name registrar and ask how. Many allow you to do it yourself via a web-based control panel.
19) POST A "FIRST ENTRY" ON BLOG AT NEW HOST
Create a new entry that will let you (and your readership) know that the blog on the new host is online. Until your redirected domain name has propagated through the DNS servers, the "last entry" on your old blog will still show up.
Advice from a Google employee on moving web hosts or changing domains.