Understanding Your Website's Root Directory
When you upload files to your hosting account, they need to go in the correct location for your website to display properly. This location is called the document root or root directory, and understanding it is essential for managing your site.
What Is the Document Root?
The document root is the folder on your server that maps to your domain name. When someone visits your website, the server looks in this folder for the files to display. For most cPanel-based hosting accounts, the default document root is:
/home/username/public_html
Here, username is your cPanel account username. Any file you place in public_html is publicly accessible via your domain.
Common Directory Structure
| Directory | Purpose |
|---|---|
/home/username/ | Your home directory — contains all account files |
/home/username/public_html/ | Main domain document root |
/home/username/public_html/subdomain/ | Typical subdomain directory |
/home/username/addondomain.com/ | Addon domain document root (varies by configuration) |
Where to Upload Your Files
Main Domain
Upload your website files (HTML, CSS, PHP, images, etc.) directly into public_html. Your homepage should be named index.html, index.php, or another default index file.
Addon Domains
Addon domains typically have their own document root folder inside your home directory. You can check the exact path in cPanel → Domains or Addon Domains.
Subdomains
When you create a subdomain, cPanel creates a corresponding folder — often inside public_html (e.g., public_html/blog for blog.yourdomain.com). You can customize this path during creation.
How to Find Your Document Root
- Log in to cPanel.
- Go to Domains (or Addon Domains / Subdomains in older cPanel versions).
- The Document Root column shows the full path for each domain and subdomain on your account.
Important Notes
- Do not delete the
public_htmlfolder — it is required for your main domain to function. - Files placed outside
public_html(but inside your home directory) are not publicly accessible. This is useful for configuration files, scripts, or private data. - The
.htaccessfile in your document root controls URL rewrites, redirects, and other Apache settings. Be cautious when editing it. - If your website shows a directory listing instead of your homepage, ensure you have a valid
index.htmlorindex.phpfile in the root directory.
Understanding your document root helps you organize files correctly and troubleshoot common issues like missing pages or broken links.