InMotion Hosting Support Center

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

Accounts on Shared Servers

Shared server accounts cannot change their Primary Domain's document root, because root access is not allowed on Shared servers. Our Technical Support can change the document root on your Shared server account per your request. You will need to submit this in a verified ticket request to Support with the following details included:

  • Domain to update document root for.

  • Full path to the directory location you want to change the document root to.

VPS and Dedicated Servers

Steps to Change the Document Root (with root access)

When a VPS or Dedicated server customer needs to make a document root change, they can do so with Root Access. The steps below will explain how to change the document root of the primary domain, with root access.

  1. ssh root@your-server.com
  2. Edit the following file:

    /var/cpanel/userdata/USER/DOMAIN

    Notice the files' contents are similar to the output below. The areas to edit are indicated by RED text.

     -
       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
  3. When finished editing the document root, run the following scripts while logged in as the root user, to rebuild and restart Apache:
    /scripts/rebuildhttpdconf
    service httpd graceful

    This ensures that your changes are updated in the Apache configuration and will allow the changes to apply immediately.

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.

Was this article helpful?

Related Questions

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

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

n/a Points
2018-01-02 8:23 pm

If you're running PHP-FPM, you got to disable and enable it for those configurations to be updated as well.

That can be done in WHM under the MultiPHP Manager option.
Staff
2,445 Points
2018-01-02 8:27 pm
Thanks for providing that extra bit of information regarding PHP-FPM. Your contribution to the Community is greatly appreciated!
n/a Points
2017-09-14 9:51 am

I did like above, I want to use a standalone account, not an alias, and change to the document_root of another account. I receive :

 

Not Found

The requested URL / was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Staff
31,093 Points
2017-09-14 1:52 pm
Here is a helpful link to our guide on 404 errors. It goes over the common causes of 404 errors.

Thank you,
John-Paul
n/a Points
2016-11-08 3:20 pm

Greeeat, it works,

really thanks

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.

5 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!