A common requirement arises in cPanel migration service is to transfer an add-on domain to a primary domain, we are trying to provide the steps to do this,
Converting an Add-on Domain to a Primary Domain
Skill Level : Beginner
In this post, I will explain how to convert an add-on domain to a primary domain. Considering a complex case, lets consider the primary domain should be a different one from the one that holds the Add-on domain.
Pre Requisites
Server Platform : Linux
User requires : cPanel and SSH access (root)
This is a Site transfer. Also both the sites I’ve mentioned here is on same server.
Case
The Add-on Domain under a website has to be converted as its Primary Domain. If you have a Full backup, its another case. I’ll explain it in another post.
Solution
Lets consider the Add-on Domain is addon.com under the user admin and the document root of the add-on domain is :
/home/admin/public_html/addon
Now it should be transferred as the Primary Domain
* Using WHM Create a New account primary.com, the document root is then say /home/primary
We’ve to transfer the whole data from /home/admin/public_html/addon.com to /home/primary/public_html first.
* The Steps will be :
root@server [/home/admin/public_html/addon]# cp -r ./* /home/primary/public_html
This will recursively copy everything inside the PWD to the specified location
Don’t forget to copy .htaccess too
root@server [/home/admin/public_html/addon]# cp .htaccess /home/primary/public_html
* Thats it, the contents are moved, but there is a database too which has to be moved eventually.
* I’ll site some type of websites like CMS and Blog :
For a Magento website, the database configuration is specified inside the local.xml file which is placed inside the /app/etc directory inside a domain. For example
root@server [/home/admin/public_html/addon]# cd /app/etc
root@server [/home/admin/public_html/addon/app/etc]# cat local.xml
* Watch for these lines in the local.xml file
<username><![CDATA[admin_user]]></username>
<password><![CDATA[password]]></password>
<dbname><![CDATA[admin_db]]></dbname>
< ![CDATA[admin_user]]>
< ! [CDATA[password]]-->