Change Main Domain Home Directory
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
I would like the domain to point to the following.
In the end, I wish to have the directory for the main domain and sub-domains like this:
Is this possible for cPanel? I have tried to add a domain-adon. But it says I can not change the main domain.
/home/cyberI would like the domain to point to the following.
/home/cyber/siteIn the end, I wish to have the directory for the main domain and sub-domains like this:
www.mydomain.com points to /home/cyber/site
dev.mydomain.com points to /home/cyber/devIs this possible for cPanel? I have tried to add a domain-adon. But it says I can not change the main domain.
-
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 0 -
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. 0 -
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 su -
Step 2: I went to the follow directory. USER being the primary user for the account. /var/cpanel/userdata/USER/
You then open the domain file. If you need help finding the file, just use ls
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 vi DOMAIN
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. /scripts/rebuildhttpdconf service httpd graceful
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.0
Please sign in to leave a comment.
Comments
3 comments