InMotion Hosting is able to change the Document root location where your Primary domain points to. This allows the file structure to be maintained how the developer wants to reference the files in the website code. This article will explain how to get the document root changed for your primary domain.

VERY IMPORTANT! Changing a primary domain doc root is NEVER RECOMMENDED by InMotion Hosting. cPanel restores packages based on default settings and miss document root changes. So if the account is moved, the accounts with the doc root change may break.

Accounts on Shared servers

Shared server accounts cannot change their document root, because root access is not allowed on Shared servers. Our tech support can change the document root on your shared server account per your request. You will need to submit this in a ticket to support with the folder (path to the directory location) you want to change the document root to.

VPS and Dedicated servers

When an VPS or Dedicated server customer needs to make a document root change, they can with Root Access. Below will explain how to change the document root of the primary domain.

Changing the Document Root (without root access)

VPS and Dedicated customers that do not have root access cannot change the document root of their main domain. VPS and Dedicated server customers without root access will need to follow the same process as the Shared server customers. In order to have the main domain changed on your server, you will need to contact tech support with the request.

Steps to change the Document Root (with root access)

VERY IMPORTANT!We do not support changes done as the ROOT user. Any time required by the system administration team to repair, troubleshoot, or restore services due to changes made (as a result of having root access) after taking root access may be billed at rate of up to $75/hr. This does not guarantee resolution of technical issues deemed outside the scope of our support.

  1. ssh root@your-server.com
  2. sudo su - root
  3. Edit the following file:
       /var/cpanel/userdata/USER/DOMAIN

    Important! If you have an SSL certificate on the account, you may need to edit the following file as well.

       /var/cpanel/userdata/USER/DOMAIN_SSL

    You should see the file like the following. The areas to edit are in RED.

     -
       customlog:
     -
           format: combined
           target: /usr/local/apache/domlogs/domain.com
     -
           format: "\"%{%s}t %I .\\n%{%s}t %O .\""
           target: /usr/local/apache/domlogs/domain.com-bytes_log
       documentroot: /home/USER/public_html
       group: USER
       hascgi: 1
       homedir: /home/USER
       ip: 123.45.67.89
       owner: root
       phpopenbasedirprotect: 1
       port: 80
       scriptalias:
     -
           path: /home/USER/public_html/cgi-bin
           url: /cgi-bin/
       serveradmin: webmaster@domain.com
       serveralias: www.domain.com
       servername: domain.com
       usecanonicalname: 'Off'
       user: USER
    Change the following lines in the file:
       documentroot: /home/USER/public_html
       path: /home/USER/public_html/cgi-bin
    The changes will look like the following:
       documentroot: /home/USER/public_html/new_doc_root_dir
       path: /home/USER/public_html/new_doc_root_dir/cgi-bin
  4. When finished editing the document root, run the following scripts while logged in as the ROOT user.:
       /scripts/rebuildhttpdconf
       service httpd graceful
Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Like this Article?

Related Questions

Here are a few questions related to this article that our customers have asked:
Change document root for primary domain
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

0 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!