A subdomain allows the developers to install staging site separately from the live site, allowing both to run independently. So before making anything live it is best to test everything on the staging site and all this can be archived by creating a subdomain.
So, to manually build a staging site on a subdomain goDaddy if you want a more open sandbox environment where you can experiment with code modifications and other things. It’s good to add subdomain rather than localhost to ensure that the hardware environment is consistent.
You can add a subdomain for free and can create as many up to 100 (depends on hosting provider’s limit) subdomains. The steps to create a subdomain are very easy, only if the individual follows these steps which are followed. The below step by step guide shows you how to set up a free subdomain for staging development.
Add Subdomain in cPanel – Works for All Hosting Like goDaddy, NameCheap, DreamHost
Here are a few steps to keep in mind when it comes to adding the subdomain for staging development for free:
#1. Using cPanel, create a subdomain
To begin, you’ll need to create a subdomain for the staging site. Locate the Subdomains option in cPanel. Although the cPanel may be formatted differently, the settings should remain the same: Create a subdomain called “staging” or something similar after that.
#2. For the new subdomain, create an FTP account
To set up a new FTP account for a specific subdomain. This guarantees that everything is maintained separately at all times. Locate and select the FTP Accounts option: Then fill in the new account information. Make sure the Directory matches the subdomain’s directory (Document Root).
#3. Put WordPress files on the staging server
After that, you’ll need to upload the site’s files using that new FTP account. To begin, download and install the most recent version of WordPress: Then, you’ll need to copy these three folders over from your old WordPress site. Also, upload those to the staging site. If the folders are particularly huge, you might be able to speed up the procedure by using cPanel’s File Manager. Otherwise, FTP is perfectly OK. Nonetheless, going through large directories may take some time.
#4. Database Export/Import
The database from the live site must then be exported and imported into the staging site. All of the file paths in the database will be immediately updated to link to the new staging site URL by the plugin.
This is critical for ensuring that your staging site truly works. Input the same directory path and URL that you used to create the subdomain. The database should then be exported. Then, for the staging site, build a new database and import all of the data. Return to cPanel and select MySQL Databases from the drop-down menu.
#5. Change the database name in wp-config.php
To use the new database details and username, modify the wp-config.php file on the staging site. Also, double-check that the database prefix is the same as the one on the live site.
It’s unlikely that you’ll need to alter anything here, but its possible dependent on the prefix used by the live WordPress site. Make careful to rename the “wp-config-sample.php” file to just “wp-config.php” if you’re editing it. Then, using FTP, upload it back to the server.
#6. Log in to the staging site and restrict access.
If everything had setup correctly, you should now access the staging site using the same username and password whatever you added or try the live sites creds (may be you have cloned it).
So guys that is how to add subdomains on your hosting account. This is a super easy way to add the subdomain for staging development for free.