Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 17
  1. #1
    Member
    Join Date
    May 2006
    Posts
    16

    Default how to swap addon domain with primary domain

    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

  2. #2
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,894
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Setup a new account using the addon domain I think would be the least problematic.

  3. #3
    Member
    Join Date
    Apr 2006
    Posts
    20

    Default

    Remove the present addon domain from his cpanel.

    Now in WHM modify accounts section change the primary domain name to that of addon domain.

  4. #4
    Member
    Join Date
    May 2006
    Location
    Johannesburg, South Africa
    Posts
    944
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    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?

  5. #5
    Member
    Join Date
    Oct 2003
    Posts
    10

    Default

    Has this had a happy conclusion - I've had a similar request

  6. #6
    Member
    Join Date
    May 2006
    Posts
    16

    Default

    still not good conclusion yet

  7. #7
    Registered User
    Join Date
    Jan 2006
    Posts
    4

    Default

    Quote Originally Posted by sparksupport View Post
    Remove the present addon domain from his cpanel.

    Now in WHM modify accounts section change the primary domain name to that of addon domain.
    This worked flawlessly for me. I had an identical situation with a hosted client whose domain changed as the result of a trade name dispute.

  8. #8
    Member sneader's Avatar
    Join Date
    Aug 2003
    Location
    La Crosse, WI
    Posts
    932
    cPanel/Enkompass Access Level

    Root Administrator

    Default Worked for me, after httpd restart

    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.

  9. #9
    Member
    Join Date
    Jun 2004
    Posts
    78

    Default

    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.

  10. #10
    Member brianoz's Avatar
    Join Date
    Mar 2004
    Location
    Melbourne, Australia
    Posts
    1,117
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    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.

  11. #11
    Tam
    Tam is offline
    Member
    Join Date
    Jul 2004
    Posts
    90

    Default

    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

  12. #12
    Member sneader's Avatar
    Join Date
    Aug 2003
    Location
    La Crosse, WI
    Posts
    932
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by brianoz View Post
    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?
    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

  13. #13
    Member brianoz's Avatar
    Join Date
    Mar 2004
    Location
    Melbourne, Australia
    Posts
    1,117
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    I don't know WHY, but cPanel does NOT delete the mail accounts associated with the add-on domain, when you delete it.
    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).

    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 ...

  14. #14
    Member sneader's Avatar
    Join Date
    Aug 2003
    Location
    La Crosse, WI
    Posts
    932
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by brianoz View Post
    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).
    And THAT is nice to know... thanks for sharing !!

    - Scott

  15. #15
    Member danimal's Avatar
    Join Date
    Jul 2003
    Posts
    79

    Default Add-on Software & DBs?

    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

Similar Threads & Tags
Similar threads

  1. Replies: 5
    Last Post: 01-28-2012, 03:42 AM
  2. How to swap main domain with addon domain ???
    By madnoob in forum New User Questions
    Replies: 1
    Last Post: 03-15-2010, 08:52 AM
  3. Can I use sub domain of my existing domain as second server primary domain
    By neo4242002 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 11-10-2005, 10:40 AM
  4. swap / switch a hosted domain with a domain parked over it?
    By spaceman in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 05-03-2004, 04:55 AM
  5. Replies: 6
    Last Post: 12-30-2003, 06:19 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube