Updated: 28 September 2026 · Applies to: cPanel & WHM 138 (Jupiter theme) and Apache 2.4 (.htaccess)
On cPanel hosting, your main domain's files are in:
/home/your-cpanel-username/public_html
Replace your-cpanel-username with your cPanel username. Some servers use a different base folder, such as /home2. To see the exact path, check Home Directory in the General Information panel on cPanel's home page.
Addon domains and subdomains
Each addon domain and subdomain has its own document root. Open cPanel › Domains and look at the Document Root column.
In PHP
Avoid hard-coding the path, so your code keeps working if the site moves. Use these instead:
$_SERVER['DOCUMENT_ROOT'] // document root of the domain being served __DIR__ // folder of the current PHP file