Moving Magento from your Subdomain to your Main Domain (and vice versa) is very seamless and easy.
All you need to do is to follow the following steps:-
- Go to Magento Admin --> System --> Configurations --> Web --> Unsecure URL & Secure URL. Change both the Secure URL and Unsecure URL to the domain that you are going to be moved to. Be sure to include the "/" at the end of the domain name.
- Go to your File Manager and click "Select All". Click "Move" and key in "/public_html" to move it to the main domain's directory.
- You may need to clear the caches at "var/cache" and "var/session" after you have moved all files over.
You can also perform the Step 1 above through the database instead of going through the Magento admin:-
- Go to phpMyAdmin. Find and click your Magento database from the list of the left bar.
- Scroll down and look for core_config_data. Click "Browse" (the first button at the side).
- Find the path "web/unsecure/base_url" and "web/secure/base_url".
- Click on the "Pencil" icon of both of the path above and edit the URLs accordingly (one path at a time).
- Click "Go" after the URLs have been edited.
Note:-
- It is advisable to backup your files and databases before performing the above stated steps.