The website’s document root is the folder on your hosting account whose contents are displayed by the web server when the domain is accessed. If you upload an index.html or index.php file here, it will appear at the https://pelda.hu/ address; a kepek/logo.png file will be accessible at the https://pelda.hu/kepek/logo.png address.
The root directory of the primary domain
On cPanel hosting, the root directory of the primary domain is the public_html folder, which is located within the user’s own (home) directory. Its absolute path is:
/home/felhasznalonev/public_html/
Replace felhasznalonev with your cPanel username. You can find this on the cPanel home page, in the ‘General Information’ box on the right-hand side, under the ‘Home Directory’ line.
Additional domains and subdomains
If your plan supports multiple domains, each additional domain and subdomain can have its own root directory. When adding a new domain via the ‘Domains’ menu, cPanel suggests a folder with the same name as the domain by default, which you can rename as you wish. For example, you can create a weboldalak folder and store the individual websites within it:
/home/felhasznalonev/weboldalak/egyikdomain.hu/
/home/felhasznalonev/weboldalak/masikdomain.com/
In the ‘Document Root’ column of the table on the ‘Domains’ page, you can see which folder is associated with each domain, and you can change this later using the ‘Manage’ button. A separate article covers the process of adding domains and subdomains.
What should you look out for?
- Files outside the root directory are not public. The other folders in the home directory are not accessible via the web, so it is advisable to store sensitive files (such as backups or configuration files containing passwords) above the
public_htmldirectory. - The name of the index file matters. The web server first looks for the
index.phpandindex.htmlfiles; if neither is present in the folder, an error message or an empty list will appear. - The
.htaccessfile in the root directory controls redirects, for example. It is a hidden file, so in File Manager, use the Settings button to enable the display of hidden files. - When you log in via FTP, you are usually taken to the home directory, so you should upload your website files to the
public_htmlfolder, not to the root directory.
The article on cPanel hosting file management explains how to upload and manage files.