If you have set up WordPress on a sub directory and you need to shift it to the primary domain, then you can follow the actions described below,
Login to the cPanel of the domain.
Click on the File-manager,
Now go to the location where your WordPress in installed.
Select all the contents of the sub-folder and copy (not move) all the contents of the sub folder into the main /public_html folder.
Once the files are copied, log into your wp-admin panel for the /*sub* site,
Then go to Settings -> General, change the WordPress Address (URL) and Site Address (URL) to the main domain name.
If you are having problems signing back to wp-admin, or getting a 404 or other error at the new domain/wp-admin web page, check your .htaccess file in the /public_html directory. Eliminate any sources to the old sub-folder in the WordPress reword rules.
For example,
RewriteBase /subfolder/ or RewriteRule . /subfolder/index.php [L}
You have to correct it as:
RewriteBase / or RewriteRule . /index.php [L}
Confirm the website is running fine as its before doing the changes, also check the internal links and make sure all working good. After that you can remove the files for the old site in the sub-folder.
Sometimes you locked out of your WordPress admin panel due to SSL issue,To resolve it you can check my article on how to disable SSL for wordpress admin panel.