Quickly and Easily Move A WordPress Site From Development To ProductionThere are numerous ways to move a WordPress site from a development environment to the live, production environment, but there’s one method I’ve found that makes things quick and easy for me. I thought I would share the process so others can have a little less pain when attempting this. I realize that this is a technical post that may not be useful to all of our site visitors, but there is a percentage of our user-base that may need this information at least once, so we’ve included it here.
Development vs. Production?
First, lets describe what I mean when I talk about a development vs. production environment. Let’s take a typical scenario in the work I routinely do.
Jane contacts me and asks if I would convert her static HTML site to WordPress. She tells me the URL of her site (let’s say it’s http://www.janesawesomesite.com) and where the site is hosted.
Once we agree to begin the project, I create a new subdomain on one of my own domains that I use mostly for this purpose. Most likely, my hosting company is not the same as Jane’s, by the way.
Let’s say I own mytestdomain.com (I don’t, but let’s pretend for this example that I do). The first thing I will do is go to the domain’s cPanel, click on Subdomains in the Domains section, and then fill out the short form to Create a Subdomain. Sticking with our example, I might create a subdomain called “jane”, so the resulting URL for my test development environment would be http://jane.mytestdomain.com.
Next, I would create a new database for the jane project, download the latest version of WordPress from wordpress.org, place the information for the new database in the wp-config.php file, upload the files to the server, and install WordPress.
With WordPress up and running on http://jane.mytestdomain.com, I begin the process of converting Jane’s content and design. Once http://jane.mytestdomain.com is running Jane’s site the way she wants, it’s time to move it over to her real, production server.
Sorry it took so long to get to the meat of this tutorial, but I felt it was necessary to make sure everyone started with a basic understanding of the process that takes place before it’s time to move the site.
Steps to move the newly developed WordPress site from development to production server
So how do I quickly and easily move the site from jane.mytestdomain.com to www.janesawesomesite.com? I follow this process exactly, and usually have the site up and running on the production server in a matter of a few minutes.
TIME THIS TAKES: Varies depending upon how large the current site is. Usually a few minutes.
2. Compress the files. On the development server (jane.mytestdomain.com in this example), go to the cPanel File Manager, select all the files for jane.mytestdomain.com, and click the Compress icon in the top navigation to create a zip file. Download this zip file to your computer.
TIME THIS TAKES: Approximately 1 minute.
3. Create a new database. On the production server (www.janesawesomesite.com), go to cPanel and create a new database. Make note of the database’s name, username and password. (You may also need special instructions from the hosting company if the database host is anything other than “localhost”, but the majority of the time, “localhost” is the appropriate host).
TIME THIS TAKES: Approximately 2 minutes.
4. Unzip and edit. On your computer, unzip the files you downloaded from the development server, and edit wp-config.php to put in new database info. Once wp-config.php is edited, select all the files and rezip them using your favorite zip managing tool. I like 7-Zip, personally.
TIME THIS TAKES: Approximately 1 minute.
5. Delete old site files and upload new site files. Since you’ve already backed up all the current files in step 1 above, you can feel comfortable in deleting all the current files and folders from the production server. Simply select them and click the Delete icon in the top navigation. Now, you need to upload the new files. Upload the newly zipped files to the production server, using the cPanel File Manager. Once the zip file is uploaded, select the zip file and click the Extract icon in the top navigation to unzip all the files to the production server.
TIME THIS TAKES: Anywhere from 2 minutes to 45 minutes or longer, depending upon your upload speed and size of the zip file.
6. Export the WordPress database. Now it’s time to export the WordPress database on the development server. You could simply use phpMyAdmin, or WordPress’s own export tool (which doesn’t export everything), but there are problems with both of these solutions. I won’t go into major details, but essentially, WordPress serializes some data, which doesn’t get converted properly via some methods of export. Because the development URL (jane.mytestdomain.com) is different than the production URL (www.janesawesomesite.com), AND the subdomain jane is a different length than the subdomain www), it’s best to export with a tool that handles serialized data properly. You don’t really need to understand the technical details, but I mention it in case you decide you want to research it further.
Quickly and Easily Move A WordPress Site From Development To ProductionFast Migration
All you need to know is that there is a great little WordPress plugin that exports the database properly and replaces the development URL with the production URL as needed.
a) Install the WP-Migrate-DB plugin on the development server.
b) Go to Tools > Wp Migrate DB. You’ll need to fill in two pieces of information.
The first is the New address (URL), which is the production URL – in our example, http://www.janesawesomesite.com.
The second is the New file path. This is a little trickier because most people don’t have this information at hand. You can usually figure it out using the Account Information section of cPanel. It will list the Home Directory in the form “/home/username”. The full file path would often be “/home/username/public_html” (where username in our example case might be janedoe). If necessary, contact the hosting company to find out what the production server’s file path – also known as server path – is. For now, we’ll assume “/home/janedoe/public_html”.
Once you’ve filled out those two short pieces of information, you can leave the rest of the checkboxes as they default (Replace GUIDs checked and Save as file to your computer checked).
Click the Export Database button which will download the exported database to your computer. (Pay attention to where it downloads so you can find it later).
TIME THIS TAKES: If you know the new file path, approximately 2-3 minutes (longer if the database is very large).
7. Import the new database. Login to the production server’s cPanel and click on phpMyAdmin in the Databases section. Look in the left sidebar and find the new database you set up in step 3 above. At this point, this database should have no tables in it yet. Now click on the Import tab at the top. Click the Choose File button to find and open the exported database you downloaded in the previous step (Step 6). You can ignore the rest of the Import settings, leaving the defaults chosen, and just click the Go button.
TIME THIS TAKES: Approximately 2 minutes, although a very large database may take a good bit longer.
8. That’s it! You should be able to now go to the production URL (www.janesawesomesite.com) and see the new WordPress site up and running.
Now, it’s possible there are some glitches. If you hard-coded the development URL anywhere in the posts or pages, then you’ll need to manually change those to the new URLs or use a search and replace plugin, such as this one. If you hard-coded the development URL in the theme templates, then you’ll need to manually change those as well.
I always double-check all of my settings as well. Especially important for SEO purposes – be sure that Settings > Reading doesn’t have the Search Engine Visibility box checked or you’ll be blocking the site from search engines.
Quickly and Easily Move A WordPress Site From Development To Production
Finally, you may need to edit .htaccess if any changes need to be made, such as adding 301 redirects from the old URLs (like www.janesawesomesite.com/about-us.html) to new ones (like www.janesawesomesite.com/about-us/). This is also very important for SEO purposes. If you do need to do this, you should have prepared this list in advance. This goes beyond the scope of this tutorial, but if you use a tool such as Screaming Frog SEO Spider, you’re able to create a list of the current site’s URLs, which you can then use to map 301 redirects to the new WordPress URLs.
It seems a little more daunting while reading this than it actually is. Within about 15 minutes (for a site that isn’t too large), you should be able to successfully move a WordPress site from a development environment to a production environment without working up too much of a sweat.
Donna Fontenot, a novelist and web geek, has been involved with web development since the mid-1990′s. What began as a fascination with HTML grew to encompass front-end web design, back-end coding, SEO, online marketing, affiliate marketing, blogging, eBusiness consulting and a love of all things WordPress.
More Business articles from Business 2 Community: