The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Change Main Domain Home Directory

Discussion in 'General Discussion' started by wstar, Oct 7, 2014.

  1. wstar

    wstar Member

    Joined:
    Oct 7, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    I see this questions on these forums but none of the answers seem to work for me. I have WHM with cPanel.

    When I create a new account it makes the default home directory as

    Code:
    /home/cyber
    I would like the domain to point to the following.

    Code:
    /home/cyber/site
    In the end, I wish to have the directory for the main domain and sub-domains like this:

    Code:
    www.mydomain.com points to /home/cyber/site
    dev.mydomain.com points to /home/cyber/dev
    Is this possible for cPanel? I have tried to add a domain-adon. But it says I can not change the main domain.
     
  2. server9host

    server9host Well-Known Member

    Joined:
    Sep 18, 2013
    Messages:
    160
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hello,

    For sub-domain it's done automatically means when you created dev.mydomain.com then it's point to /home/cyber/dev document root.

    For the main domain you need to contact to your hosting provider.

    Thanks
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    It's not possible to change the default document root for the primary domain name associated with the account if you do not have root access to your system. You will have to consult with your hosting provider to have them make that change for you.

    Thank you.
     
  4. wstar

    wstar Member

    Joined:
    Oct 7, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    I did have access to the system. After many hours of searching, I have found the solution. I thought it would be nice to share. These are the steps I followed. I hope they help someone else out there.

    Indeed you must have root access to the server using SSH.

    Step 1: Login using SSH as a root user. In my case, I had to create a normal user and enter

    Step 2: I went to the follow directory. USER being the primary user for the account.

    You then open the domain file. If you need help finding the file, just use
    to list the files.
    Special note: If your site is SSL, you must edit both the normal domain and the SSL version.

    I opened the file using

    Once open, look for the directories. There should be two.
    Once changed, save the file and exit the editor. Remember to change the SSL version of the domain also if you have it.

    Step 3: Run the following commands and it will instantly work.

    Once last note. If you are then trying to create sub-domains, you must give access for the user to create them on the parent folder. This option for me was in the Server Tweaks.
     
Loading...

Share This Page