Changing the document root for your domai

This is Being 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. 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 [email protected]
  2. sudo su - root
  3. Edit the following file:

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


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

           format: combined
           target: /usr/local/apache/domlogs/
           format: "\"%{%s}t %I .\\n%{%s}t %O .\""
           target: /usr/local/apache/domlogs/
       documentroot: /home/USER/public_html
       group: USER
       hascgi: 1
       homedir: /home/USER
       owner: root
       phpopenbasedirprotect: 1
       port: 80
           path: /home/USER/public_html/cgi-bin
           url: /cgi-bin/
       serveradmin: [email protected]
       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.:
       service httpd graceful
  • 34 Users Found This Useful
  • website, weebly
Was this answer helpful?

Related Articles

 Creating Landing Pages

Create a temporary one page site Also known as a landing page or an under-construction page,...