Moving Your WordPress Site From a Development Server to Live

This article assumes that you have a Staging Environment Version of your WordPress site already set up and tested and are looking to move that site into a Live Environment.

1. Create Live Database

So assuming you do NOT have a Live Database set up at this stage we will first need to create our Live Server Database

  1. Go back to cPanel and go to the Database section.
  2. Click ‘MySQL Databases’
  3. Give your Live server DB a name — e.g. mysite_livedb
  4. Click Create Database
  5. Add a new User (or use the existing Staging DB user e.g. mysite_admin). We’ve found that using one Database user for both the Live and Staging servers makes copying the database from Staging to Live easier.
  6. Add that user to our new Database

2. Copy Staging DB to new Live DB

  1. Go To phpMyAdmin and select your STAGING Database from the list on the left.
  2. Click On The Operations Tab
image

3. Select the Copy Database To option. Enter in the name of your Live Database that you created in step 1, e.g. mysite_livedb. Remember to also deselect the CREATE DATABASE option if it is selected.

image

3. Run SQL Queries to Change URLs From Staging Versions to Live Versions

Your Staging URL (ORIGINAL_URL) will be something like: staging.yoursite.com

Your Live URL (NEW_URL) will then be something like: yoursite.com

UPDATE wp_options SET option_value = REPLACE(option_value, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_posts SET guid = REPLACE(guid, 'ORIGINAL_URL', 'NEW_URL');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'ORIGINAL_URL', 'NEW_URL');

4. Copy Files In File manager

You should have a fresh, empty install of WordPress already installed waiting to be used after you set up your hosting with your provider. Our final step is to add our website files from the Staging server. Our empty Live WordPress site should be located at somewhere like: /public_html/

  1. Select File Manager in the cPanel
image

2. Select the Root folder for your Staging/Dev Server

image

3. You need to copy the UploadsPlugins and Themes folders and their contents. All three are found in the wp_contents folder. Right click on the 3 folders one at a time and choose the Copy Option.

4. The next window will ask you where to copy the files to. This is super important. We need to ensure that the right folder is selected.

Where it says “Type the path you wish to copy” you should be able to leave this as it is, this should be the folder you have just right clicked.

In the text box at the very bottom will be the path being copied to. The path is usually set to the current path by default. We don’t want this, we want it set to our LIVE file location. So you will need to do something like this:

Replace: /public_html/staging/wp-content/

With: /public_html/wp-content/

i.e. remove the ‘staging’ text

5. Update wp-config

Almost there, we just need to update our wp-config file to contain our Live DB login details. You can access the wp-config.php file in the File Mamanger also and choose ‘Edit’.

  1. Use your Live DB user, password and database names.

6. Access the Live Site and Save Permalinks

  1. Navigate to the URL admin panel, e.g. http://mysite.com/wp-admin
  2. Login using your WordPress user credentials — should be same as local and staging site.
  3. Go to Settings in Dashboard -> General -> Click Save
  4. Go to Settings -> Permalink -> Click Save
  5. Ensure ‘Discourage search engines from indexing this site’ is unchecked