# Change Document Root in cPanel

There are two types of domains on a cPanel box that can have document roots: Main (primary) domains and Add-on domains.

### Changing Primary domains

cPanel’s default primary domain’s document root is: `/home/USERNAME/public_html`. We need to configure your server/domain’s document root to the `/home/USERNAME/public_html/public`.

For changing the main/primary domain, you will need to have `root SSH access`, and be able to locate and edit the following file (replacing your user & domain info):

    var/cpanel/userdata/USERNAME/DOMAIN.COM

1. Once you open the file, look for the following line:

    documentroot: /home/USERNAME/public_html

2. Modify the location like this:

    documentroot: /home/USERNAME/public_html/public

3. Save it and exit.

4. Rebuild the Apache conf and restart Apache:

    /scripts/rebuildhttpdconf
    service httpd restart

The change will be immediate. Simply clear your browser cache and force refresh the page!

### Changing Add-on Domain

Changing the document root for Add-on domains is easy. Simply log into your cPanel and navigate to: `Domains >> Addon Domains`.

Next, edit the Add-on domain path. To do so, simply click the “Edit” icon next to the path, and type in your new path. It’s that simple!

### Creating a Sub-domain

If you want to use a sub-domain for this application. Just create the subdomain and set the path to the `public_html/subdomian_directory/public` To create a sub-domain, imply log into your cPanel and navigate to: `Domains >> Subdomains`.

Was this page helpful?
Yes No

### How can we improve this documentation?

### Leave Comment Cancel reply

You must be logged in to post a comment.