If you want to create a copy of your WordPress website into a sub-domain for working purpose as well as to keep the original, the process will need several steps to follow:
Step 1: First login to your cPanel dashboard.
Step 2: Create the sub-domain you want to be used for accessing the testing site.
Step 3: Go to File Manager, then check Show Hidden Files
Step 4: Copy WordPress Files from your current directory to the document root directory created for your sub-domain. The root directory of the subdomain can be put in the pop-up window. Copy the.htaccess file. This file should be kept in the same location where your WordPress files are copied or at the root of the new location. The .htaccess file may contain the substantial reference to the current WordPress installation.
Step 5: Create a database which can be utilized to segregate the new sites from your main site. Determine that you've saved the database name, username, and password because you'll be required further.
Step 6: Export your current database using cPanel>phpMyAdmin. If not aware of which database to export, locate the wp-confic.php file in your File Manager and use "View" option.
Step 7: Import your database to the new database you created recently.
Step 8: Configure the new WordPress wp-confg,php for the test site. This configuration requires to accomplish or the sub-domain site will use the database of main WordPress site. Use "Edit" option in the "File Manager". Determine the changed file is the one which resides in the folder of the subdomain, not the main domain.
Step 9: Change the site URL for the test site in phpMyAdmin. The site URL will be stored in the database WordPress, in order for the site to load as a test site, the URL of the site will require being changed to the sub-domain URL.
Step 10: Make sure that links for images in your pages and posts are also changed. They are in the database, and not connected to the URL of the site. Therefore, they will need to be changed independently. Finally, search the database for the original URL and then it in the result.
Finished! Copying of your WordPress website has been successfully completed.