I have a client want to change his primary domain to addon domain and vice versa. What is the best way to do that.
Thanks
I have a client want to change his primary domain to addon domain and vice versa. What is the best way to do that.
Thanks
Setup a new account using the addon domain I think would be the least problematic.
Remove the present addon domain from his cpanel.
Now in WHM modify accounts section change the primary domain name to that of addon domain.
But how would one do this is either the main domain, sub domain, or addon domain already contains data and user files? Removing the domain will remove the user's files (email, DB's, scripts, etc) as well, right?
Has this had a happy conclusion - I've had a similar request
still not good conclusion yet
For an Add-on domain, I would think you'd also have to move all the files from the subdirectory that the Add-on domain used to point to, into the main public_html folder. That may be obvious, but thought it was worth mentioning.
- Scott
Last edited by sneader; 12-26-2007 at 04:15 PM.
I just had a similar request from a client who wanted a 'Parked' domain to replace their primary domain.
The method posted above by sparksupport worked fine for this transition also but I also had to edit their .htaccess file because, it left the old redirect information intact throwing a 500 error.
With the method recommended above ("delete the addon and rename the primary") the problem is that you may lose all the stuff associated with the addon when you remove it.
Has anyone tested whether associated email accounts actually do get lost?
If so, I'm pretty sure restoring the home directory accounts after the change will restore the mail accounts, I think we have tested this although as it was done by one of my team I don't recall details.
If cpanel doesn't delete the email accounts when the addon is removed, the whole problem goes away as it's simply a matter of removing the addon/parked domain and renaming the primary, then adding back the other domain.
We often have to move an addon domain to a new account, but have not changed one to a main domain in the manner you indicate, although the method we use would work just as well with the only exception of email accounts which would have to be recreated because of the mail address on the subdomain component (i.e. address@addon.maindomain.com). We offer to recreate the email accounts for the client if they wish us to, but that of-course involves letting us know the password(s) required as well as the email address(es).
First we create a temporary folder outside of their web space and move all files from the addon domain's folder to that temproary directory.
Then we delete the addon domain (from within their cPanel to ensure it is deleted properly).
Then we create the desired account for the old addon domain and move the files and folders from the temporary folder to the new account's public_html folder (in your case we wouldn't want to change the main domain on the existing account because we want to move the addon domain's files and folders into the web root on that account and preserve the old main domain's files and folders).
We then chown -R the public_html folder to the new username. That complete's the creation of the new account with the addon domain now becoming the main domain for that account.
Your next step would be to move all of the files and folders in the public_html folder of the old account (the main domain for the old account) into a temporary folder and then delete that account. Create an addon in the new account and move the files and folders from the temprary folder to the new addon domain folder and recursively chown (as before). But you will have to recreate, or ask the client to recreate all email addresses for both domains.
Once you've chowned, you will have to reinstall Frontpage extensions if they were in use, and sometimes we see a 500 Internal Server error which is cured by 'chmod 0755 /home/username/www' (replace username with the acutal username of-course).
It looks like a lengthy process, but with something like WinSCP, its actually prettty quick and easy to do.
Last edited by Tam; 03-22-2008 at 04:49 AM. Reason: missed a bit
Yep, I have done a lot of these lately, and it really works! I don't know WHY, but cPanel does NOT delete the mail accounts associated with the add-on domain, when you delete it. So, it's really easy to delete the Add-on domain... use Modify Account to change the primary domain for the account, to the former Add-on domain name.... and it works!
- Scott
Ah ... that's so nice to know! I just tested and while it KEEPS the mail accounts (mail/domain.com/account/* and etc/domain.com) it DELETED the forwarders file (/etc/valiases/domain.com).I don't know WHY, but cPanel does NOT delete the mail accounts associated with the add-on domain, when you delete it.
Not hard to restore the forwarders though, once you're expecting this to happen. Pity it doesn't have a "keep forwarders" button. This could be implemented by copying the forwarders file to the mail/domain.com directory then checking for it on creation of a parked or addon domain.
Not sure if there's any way to code this yourself ...
How does this handle fantastico-installed software? I am in this situation but the add-on domain has a word-press install on it.
-Danimal![]()