Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Set a Document Root Outside public_html

This guide shows how to make an addon domain or subdomain use a folder that is not inside public_html.

WHM2 min read12 steps

What is a document root?

The document root is the folder where a website's files live. When someone visits your site, the server looks in that folder. By default, cPanel puts new addon domains and subdomains inside public_html, for example public_html/shop.

An addon domain is an extra website name on the same hosting account. A subdomain is a part of your main name, such as blog.example.com.

Some people prefer a folder outside public_html, like /home/username/mysite. It keeps sites apart, so the main site does not also serve the other site's files under its own address.

Steps

  1. Log in to cPanel.
  2. Open Domains. On older cPanel, open Addon Domains or Subdomains instead.
  3. Click Create A New Domain.
  4. Type the domain or subdomain name.
  5. Untick Share document root if you see it. This lets you choose your own folder.
  6. In the Document Root box, type the folder path without a starting slash. It is relative to your home folder. For example, type mysite instead of public_html/mysite.
  7. Click Submit.

cPanel creates the folder in your home directory, next to public_html.

Change an existing domain

  1. Open Domains in cPanel.
  2. Find the domain in the list.
  3. Click Manage next to it.
  4. Find Document Root, click the edit option, and type the new folder.
  5. Save the change.

Warning: Changing the folder does not move your files. The site will show an empty page until you copy the files into the new folder. Take a backup first. Use File Manager to move the files.

Tip: If you cannot find these options, your plan or cPanel version may use different menu names. Ask Hostvento support for help.

Quick recap

  • The document root is the folder a website is served from.
  • In cPanel, use Domains and type a folder name that does not start with public_html.
  • Existing files are not moved for you, so copy them over yourself.
  • Back up before you change anything.