Migrating MAMP locally hosted WordPress Multisite to live server

This is the second post about my journey working with WordPress Multisite. You can also read my first post on this topic: Developing a WordPress Multisite Network of Sites Using Thesis Theme.

My situation is: I am redesigning a website and a blog and I decided to hook them together using WordPress’s Multisite function to make future administration much simpler. I’ve got Website-1 which is not currently using WordPress and Blog-1 which is currently on WordPress and is a subdomain of Website-1. They each will have their own domain names. I’ve developed the website on my computer using MAMP. Now I need to move the newly designed site to the live server and map the domains.

The official WordPress Codex article: Migrating Multiple Blogs into WordPress 3.0 Multisite

Steps to Move from Local to Live Server:

  1. Backup your localsite and livesite, both database and files. How-to on the Codex.
  2. Grab the database that was created locally for import to the livesite server. Navigate to phpMyAdmin on MAMP screen in your broswer. Export the localsite database to your computer as a zipped SQL file.
  3. Using FTP to connect to your livesite server, upload all the local WordPress files to your livesite in the root directory (public_html). Don’t place them in a folder. To be clear, you are uploading all the contents of WordPress folder, but not the folder itself. This upload will take a while. While that’s going on….
  4. Log in to cpanel for your livesite and go to MySQL Databases. Create a new Database and a User. Write down the Database name, User, and Password. Give User all privileges.
  5. On the FTP, open up the wp-config.php file just uploaded to your livesite server and make these changes to the database name, user, password in the file. (See Step 3 on this helpful walkthrough.)
  6. In cpanel, go to phpMyAdmin and import the localsite database saved to your computer in step 2 to your newly created database.
  7. In cpanel phpMyAdmin, open up the new database. You will need to make several changes to the domain and site_url fields. (Instead of pointing to http://localhost, you want your site to point to http://yourdomain.com.) For this step, follow the instructions on this blog post, and I followed steps 6-13. Make sure to read the comments about changed the blogs_id as well.

Domain Mapping

I wanted to use distinct URLs for both the Website-1 and Blog-1. When you set up multisite with a subdirectory install, the default URLs look like:

http://website-1.com

http://website-1.com/blog-1

How do you redirect the second URL to http://blog-1.com?

This is where a handy plugin, called WordPress MU Domain Mapping, comes in handy. (Although it frustrates me that this is not an option included with WordPress itself and that it’s so darn hard to find good documentation on how to complete domain mapping for a newbie like me!)

I would recommend backing up before installing the plugin, because I had problems the first time, probably due to my own ignorance.

OK, because I often use a mash-up of the walkthroughs I read, here are the steps I took to map my blog’s domain:

  1. Download WordPress MU Domain Mapping plugin. Log in to FTP. Drop the unzipped folder into ‘Plugins’ folder in ‘wp/content’. Copy ‘sunrise.php’ and paste into ‘wp-content’ folder.
  2. Edit ‘wp-config.php’. Add the following line of code before the line /* That's all, stop editing! Happy blogging. */:
    define( 'SUNRISE', 'on' );
  3. Log in to WordPress Network Admin area. Go to ‘Settings’ — ‘Domain Mapping’. Add your IP Address. Click options as desired. I just did ‘Permanent Redirect’. Click ‘Save’.
  4. Got to ‘Settings’ — ‘Domains’. Define the site id (2 for me) and the domain to redirect to (for me blog-1.com).
  5. In my case, I didn’t need to edit the DNS, because that domain was already pointing to the IP Address, under an old WordPress install. I deleted the old Subdomain and Addon Domain in cpanel.
  6. Then in cpanel, I added a Parked Domain, directing blog-1.com to public_html (the root where my WordPress Multisite is installed).
  7. Click refresh (maybe wait two minutes) and your new domain mapping should be working fine.

I hope this walkthrough has been helpful! If you have any comments or updates, please share in the comments below. Happy coding!