How to create a Wordpress staging sub-domain on cPanel
Note: This is an advanced guide and may take 1hr+ to complete. Please note that if the steps are followed incorrectly and the site fails to load, our support team will not be able to investigate or fix any development problems. If required, we could perform a manual migration to carry out these steps on your behalf. You can find more information
in this guide.
The information in this guide is provided as a suggestion, and we can't provide detailed support for modifications to a Content Management System. If you require assistance with this, we'd recommend speaking to your website developer to ensure relevance and compatibility with your site.
Step 1 - Decide what domain you'd like to use for your staging site. We'd recommend creating a subdomain like '
dev.yourdomain.net.au'. If you'd like to use something else, you can modify the provided steps as needed.
Step 2 - Log into cPanel and create a subdomain for 'dev.yourdomain.net.au'. We have a guide on this process
here.
Step 3 - Open the
File Manager.
Step 4 - Navigate to the public_html directory (or the folder that is currently hosting the live website), then:
(1) Click on
Select All.
(2) Click
Copy.
(3) Change the file path to /dev.yourdomain.net.au/ (Or the place where your staging site files are going to be stored).
(4) Click
Copy File(s).
Step 5 - Go into the
sub-domain folder (dev.yourdomain.net.au in this case).
(
1) Find the
wp-config.php file.
(
2) Right-click (Windows) or Command+click (Mac), then click on
Edit.
Step 6 - Find the lines relating to the MySQL database username and password. Keep this page open for the next few steps, as you will need to modify these details.
Step 7 -Open a new cPanel Window and use the MySQL Database Wizard to make a new, blank database and user.
Click here for a guide on how to do this. Make a note of the newly created
database name,
username and
password somewhere on your computer.
Step 8 - Go back to the
wp-config.php file. Replace the existing database details with those of the database and user you just created.
If, for example, you set up a database with the following details:
Database Name: yourdoma_wp01
User: yourdoma_admin
Password: Password123!!!
Then your
wp-config.php file will look like this:
Make sure to hit
Save Changes to update the new database details.
Step 9 - Export the live database into an .sql file, then
Import it into the new, blank database you created. You can use
this guide to export and import databases.
Step 10 - Finally, you will need to update the primary URL associated with the Wordpress installation (from, for example, yourdomain.net.au to dev.yourdomain.net.au).
Click here for a guide on doing that.
Note: The login to the admin section for the live site will be the same, but there will be a different login link available as well. If you previously accessed the admin panel using, for example, yourdomain.net.au/wp-admin, the new link for the dev site will be dev.yourdomain.net.au/wp-admin. Try /wp-login.php if you get an error when going to /wp-admin.
You can now start work on your development site. Once you are ready to bring this site live, you can use
this guide to do so.
For more tutorials on website development and Wordpress troubleshooting, view our List of Wordpress Guides.