Document Root
Document root (also web root or public_html) is the server folder that is the starting point for a domain’s public files. When someone visits example.com, the web server looks for index.php or index.html there — not in a random home directory folder.
Understanding the root prevents the classic moment: “I uploaded the files but the site still 404s.” Usually the files landed in the wrong folder.
A Simple Analogy
If the hosting account is a house, the document root is the front room visible from the street. Storage rooms can exist elsewhere for private data, but guests do not automatically see them via a URL. Leaving secrets in the front room is the same as leaving them in a downloadable web root.
Common cPanel Patterns
| Domain | Typical document root |
|---|---|
| Primary domain | public_html/ |
| Addon domain | public_html/domain/ or similar |
| Subdomain | public_html/sub/ or a path you choose |
Modern frameworks (Laravel and others) often point the root at a public/ subfolder so application code is not directly exposed.
How DNS and SSL Fit In
Document root is about files on disk. DNS only points the hostname at the right machine. Both must match: DNS to server A while files sit on server B yields empty sites or default pages. SSL certificates are issued per hostname, not “once for every folder.”
What to Watch For
- Uploading a theme into the wrong root yields blank sites or the wrong brand
- Do not store secrets or sensitive backups inside a downloadable web root
- FTP/SFTP paths must match the vhost document root
- After migrations, align CMS URLs with the real root
- Permissions that are too open or too tight both cause errors
FAQ
Can I change the document root?
Often yes in modern Domains UIs. Keep DNS and SSL aimed at the same hostname.
public_html vs www?
On many hosts www is a symlink or alias to public_html. Confirm in File Manager before editing.
Why 403/404 after upload?
Files may sit in the home directory instead of that domain’s document root. Match paths to the domain settings.
Where is wp-config.php?
Usually in the WordPress document root or one level above public in custom setups. Never expose that file on a public URL.
Disclaimer: Hosting Wiki articles are prepared for educational and reference purposes. Hosting technology keeps evolving, so some technical details may change over time.