I recently moved one of my client’s websites from a staging site to a live site, and thought that this would be a good opportunity to write a step-by-step procedure of how it is done. It can seem like a daunting task if you’re new to website design and development, as there are a few moving parts to consider. Hopefully this step-by-step guide will help you with the process of how to move a WordPress staging site to a live site using Cpanel.
Before we dive into the process of how to move a WordPress staging site to live using a cPanel, let’s take a quick refresh on what a staging site is.
What is a Staging Website?
To put it simply, a staging website is a clone of your live website. Staging sites are generally used to test any major feature or change that you are wanting to make on your site, but in a secure environment, rather than on your live site for all to see. Website developers typically use staging websites to fix any bugs and test out any large changes before going live on a public-facing website.
Staging websites can be helpful to try new plugins, themes, code snippets and integrations with other programs, with zero risk to your existing website. They also don’t have to be used just for testing. Staging sites can be used for the entire development process to build a brand new website, which can then easily replace the client’s site that is live on their domain.
Now that we are caught up in what a staging site is, let’s dive into how to move your WordPress site from a staging environment to live using a cPanel.
Part 1: Backup your staging website and live website
Prior to moving your staging website to your live site, it is highly recommended to create a backup of each site before pushing the staging site to the production website. Here are the steps I recommend:
- Login to your hosting provider. This can be providers such as GoDaddy, Crazy Domains or BlueHost.
- Access the cPanel > File Manager > [staging site folder].
- Highlight everything inside the folder > Right-click on any of the folders and click ‘Compress’. (Note: ‘compress’ will package up all the files and folders into a single archive file for you to download as a copy).
- A prompt box will appear. Give the compressed archive a name that is easy to reference. For this tutorial, the backup archive is named ‘staging-site-backup.zip’. If you are unsure which compression to choose, use ‘zip’.
- Right click on the compressed archive file > Download. This will provide you with a copy on your computer’s local drive.
- Once you have completed these steps, repeat the same process for your live site folder (typically in the ‘public_html’ folder).
Part 2: Backup your staging and live site databases
Now that you have backed up both your staging site and your live website, you need to backup each database. To put it simply, a website database is a system that stores the data that your website needs to access. Here are the steps to backup your staging and live site database.
- Access cPanel > phpMyAdmin.
- On the left navigation bar, navigate to the staging site database.
- Note: if there are more than 1 databases showing, you will need to ensure you choose the correct one. To find the name of your database for your site, you will need to access File Manager > /public_html/wp-config.php. Once you have located the wp-config.php file, right-click on it and select ‘edit’ or ‘view’..Once inside, navigate to the value called DB_NAME. The string of numbers or letters after it is the WordPress database name.
- In the main panel, click ‘Export’.
- Choose the Quick export method > SQL format > Go (this will download the database onto your computer’s local drive for you to save).
- Repeat the same process for your live website database.
Part 3: The migration process – moving the staging site to live
Once both the websites and the databases have been successfully backed up, it is now time to start the migration process. Follow these steps to move your WordPress staging site to your live site, using cPanel:
- Access cPanel > File Manager > navigate to public_html folder.
- Create a folder called ‘old’. Highlight everything in public_html folder (except for old folder), then move it all to the ‘old’ folder.
- Navigate to the staging site folder, then move all files and folders to public_html folder.
- Go back to cPanel Home > phpMyAdmin
- Navigate to the staging site database and click the database name in the left column. This will bring up all the tables/files in the database.
- Locate the ‘Options’ table (wp_options) and update the option values of ‘siteurl’ and ‘home’ to the correct URL. For example, from dev.somewherestudio.com to somewherestudio.com
- Open a new page on your web browser and type in your domain name and access WordPress backend (e.g. [domain name/wp-admin]) > Update Permalinks.
- Be sure to check the entire website for any broken links. If you have too many links to check, there are plugins available for your convenience.]
Part 4: Clean up the cPanel
Once you have checked that your website is operating as it should and there are no missing/broken links, you can clean up any redundant files in the cPanel.
- Delete the previous version of the website in File Manager (located in the ‘old’ folder).
- Delete the redundant database.
- Delete the subdomain if no longer required for any further staging.
Website maintenance
Now that you have moved your WordPress staging site to your live site using cPanel, be sure to keep your site up-to-date by regularly updating plugins, themes and site content. It is also best practice to regularly backup to ensure you always have a copy, should anything happen.
If you need any help with this process, or would love more information on general website maintenance, we’d love to chat! We provide on-going services and support for all kinds of businesses and their website needs.
Reach out via our contact form and we’d love to see how we can help!