How to Create a WordPress Staging Site with cPanel

Do you need assistance in creating a WordPress staging site using cPanel? A staging site, also known as a test site or development site, is an exact replica of your live site. It allows you to make changes privately without affecting your live site. This is an incredibly valuable tool if you are:

  • Testing plugins for compatibility
  • Ensuring that your WordPress theme is compatible with new updates
  • Implementing major features and content on top of your current site
  • Fixing glitches, bugs, or security vulnerabilities
  • Building a new site, among many other reasons.

If your WordPress site generates income or experiences high traffic, learning how to create a staging site with cPanel will help reduce disruptions. For instance, if something goes wrong on the staging site, you can easily revert the change, delete everything, and quickly duplicate your live site again.

In this step-by-step tutorial, we will guide you on how to manually create a WordPress staging site using cPanel, essentially for free. While plugins and services are available for your convenience, they may come with a fee. So, if you are on a budget or simply curious, let’s get started!

Step 1: Create a Subdomain

Login to your cPanel and create a subdomain. The location of this option may vary depending on your cPanel setup, but you can typically find it under Domain > Subdomain. Take note of where the staging folder is located in your directory. For example, in this tutorial, the staging folder is located at: (remember, yours will be different).

See also  Uploading Squarespace Website to CPanel

Subdomain Creation

Step 2: Duplicate the Live WordPress Site to the Staging Site

From cPanel Home, access File Manager and navigate to your ‘public-html’ folder. Copy everything in this folder and paste it into the staging folder. However, if the ‘staging folder’ is also inside ‘public-html’, avoid duplicating that folder.

Duplicate WordPress Site

After copying the files, go into the staging folder and find a file named ‘wp-config.php’. Right-click on the file and select View. Approximately 30 lines down, make a note of your database name and database username. These will be important later in the tutorial.

View wp-config.php

Step 3: Duplicate the Live WordPress Site Database

WordPress not only consists of pages to display your site, but it also includes a database that manages and pushes important data, ensuring your site looks and functions correctly.

Exit File Manager and go back to cPanel Home. From there, navigate to phpMyAdmin.

  1. On the left navigation bar, click on your live site’s database name.
  2. On the right panel, click on Operations.
  3. In the ‘Copy Database to’ subpanel, assign a new name to your staging database. For instance, in this tutorial, we’ll name the staging database ‘atdp_staging’.
  4. Click Go to start the duplication process. It’s crucial to wait and not interrupt this process to avoid creating a corrupted database.

Duplicate WordPress Database

Step 4: Configure the Staging Database

  1. In phpMyAdmin, navigate to your newly duplicated staging database.
  2. Go to the ‘options’ table.

Note: Each WordPress database installation usually has tables with prefixes. For example, ‘wp_options’. The prefix may vary, but most of the time, you’ll find a ‘[prefix name]_options’ table.

See also  ProgramMatek's Affordable Reseller Hosting Plans

Staging Database Configuration

  1. Locate the ‘siteurl’ entry and click Edit. Change the URL to the staging URL and click Go. If you can’t find ‘siteurl’ in the table, use the ‘Filter rows (*)’ option to search for it.

Edit siteurl

  1. Repeat the same process for ‘home’. Change the URL to the staging URL and click Go.
  2. Exit phpMyAdmin and return to cPanel Home.

Step 5: Assign the Staging Database to the Database Username

Recall that in Step 2, you were asked to note down the database username. At cPanel Home, go to MySQL Databases and click on Add User to Database.

Assign Staging Database

In the ‘User’ panel, refer to your notes from the staging ‘wp-config.php’ file for the database username. In the ‘Database’ panel, add the name of the duplicated staging database from phpMyAdmin. Finally, click Add.

You will be directed to another page to provide permissions for the user (e.g., webmaster/administrator). Tick ‘All Privileges‘ and click Make Changes. Then, exit the MySQL Databases section and return to cPanel Home.

Assign Permissions

Step 6: Configure the ‘staging/wp-config.php’ File

Open File Manager and navigate to the staging folder. Right-click on the ‘wp-config.php’ file and select Edit.

Edit wp-config.php

You will see a warning prompt. Create a backup of wp-config.php (just in case) and click Edit again. Approximately 30 lines down, change the database name to the one you created in phpMyAdmin. Click Save Changes and then Close.

Update wp-config.php

Exit File Manager and log out of cPanel.

Step 7: Finalize the Staging Site

Congratulations, you’re almost there! Well done for coming this far.

Open your web browser and enter the staging site URL followed by /wp-admin to access the backend. For example,

Tip: The username and password are the same as the ones on your live site.

See also  Installing Joomla on a cPanel VPS

Access Staging Site

In the Common Settings section, select Post Name and click Save Changes. This step is important because the permalinks still refer to the live site. Updating this ensures that the permalinks reference the staging site.

Finished…But Wait!

That’s the end of the tutorial! You now know how to create a WordPress staging site with cPanel, allowing you to safely make edits on the staging site without affecting your live site. But wait! What happens when you finish editing the staging site and want to migrate everything to the live site? Stay tuned for our upcoming tutorial, which will be released next week. Watch this space!

If you found this tutorial useful, please leave a comment below and share this blog. Let us know if you have any topics you would like us to cover in the future.

Happy staging!