+254725682556 +254725052660 info@ziprof.co.ke
Client Area

General Knowledge

What Is the public_html Folder and Why Do Your Website Files Go There?

When you log in to your hosting account, you'll notice a folder called public_html sitting near the top of your file structure. This is the document root: the one folder your hosting server actually serves to visitors when they type in your domain name. If a file isn't inside it (or inside the right subfolder for an addon domain), your website simply won't show it.

Where to find public_html

You can see this folder two ways:

  • Through your control panel's File Manager, where it usually appears as soon as you open the tool.
  • Through an FTP or SFTP client, where it sits in the root directory of your account after you connect.

Everything a visitor can reach on your main domain, your homepage, images, CSS files, and any subfolders you create, needs to live inside this one folder.

Why your homepage file has to sit directly inside it

Your server looks for a specific file, usually index.html or index.php, directly inside public_html and loads that as your homepage. If that file is missing or buried inside an extra subfolder you created by mistake (for example public_html/mysite/index.php instead of public_html/index.php), visitors will either see a blank page, a directory listing, or a 404 error instead of your site.

Never rename or delete the public_html folder itself. Doing so will take your entire main website offline until it's restored, since the server has nothing to point to.

How public_html works with addon domains and subdomains

If you host more than one website on the same account, the way extra domains relate to public_html differs depending on your control panel.

In cPanel

When you add an addon domain, cPanel creates a new subfolder inside your existing public_html folder (for example public_html/addondomain.com) and points the new domain at it. Your main domain's files stay directly in public_html, while each addon domain gets its own folder inside it.

In DirectAdmin

DirectAdmin handles this differently: each addon domain gets its own, separate public_html folder under a domains directory (for example domains/addondomain.com/public_html), rather than a subfolder inside your main site's public_html. The two folders are independent, so files you upload for one domain never appear on the other.

Common mistakes to avoid

  1. Uploading your website's files into the folder above public_html instead of inside it. They won't be visible to visitors at all.
  2. Creating an extra nested folder (like a copy of your project's root folder) and uploading everything inside that, instead of uploading the contents of your site directly into public_html.
  3. Mixing up which public_html belongs to which domain when you're managing more than one site, especially in DirectAdmin where each domain has its own separate folder.

If you're not sure where your files currently sit, you can open your control panel's File Manager and check the folder structure before uploading anything new.