Moving magento site from subdomain to main domain (and vice-versa) is quite easy. And you can do it by two different way and you will feel it is more easy when you go through how to do it.
Process I:
You need to do as per following steps to achieve this:
STEP 1:
- 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.
STEP 2:
- You may need to clear the caches at “var/cache” and “var/session” after you have moved all files over.
Process II:
You can also do the same process by another way:
STEP 1:
- Go to phpMyAdmin. Find and and choose your database on which your magento site is running.
- Scroll down and look for core_config_data table and click “Browse”.
- 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.
- Click “Go” after the URLs have been edited.
STEP 2:You may need to clear the caches at “var/cache” and “var/session” after you have moved all files over.
Note:- It is always good to have backup your files and databases before doing these exercises.