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:
- Backup your localsite and livesite, both database and files. How-to on the Codex.
- 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.
- 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….
- 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.
- 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.)
- In cpanel, go to phpMyAdmin and import the localsite database saved to your computer in step 2 to your newly created database.
- 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.
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:
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!)
- There is a detailed walkthrough found on WPWebHost: Using multiple Domains with WordPress MU
- Another detailed walkthrough is found on OttoPress: WordPress 3.0 Domain Mapping Tutorial
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:
- 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.
- Edit ‘wp-config.php’. Add the following line of code before the line
/* That's all, stop editing! Happy blogging. */:
define( 'SUNRISE', 'on' );
- 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’.
- Got to ‘Settings’ — ‘Domains’. Define the site id (2 for me) and the domain to redirect to (for me blog-1.com).
- 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.
- Then in cpanel, I added a Parked Domain, directing blog-1.com to public_html (the root where my WordPress Multisite is installed).
- 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!