What Is the public_html Folder?

Category: FTP & File Management ยท Updated 2026-11-03

The public_html folder is the directory on a hosting account that a web server treats as the visible root of a website, meaning anything placed inside it can be reached by a browser at your domain name. Files stored outside public_html, such as in the account's home directory, are not reachable from the web at all, which is why it is the required location for a site's homepage, images, scripts and other public files.

What makes public_html special

On most Linux hosting accounts, the web server is configured so that one specific folder, almost always named public_html, is treated as the document root for a domain. When someone types your domain into a browser, the server looks inside that folder for a file to serve, typically index.html or index.php. The folder name itself has no special meaning to the server beyond being the one the configuration points to; it is a long-standing convention across cPanel, WHM and most shared hosting setups rather than a technical requirement of the web itself.

What goes inside it

public_html/
  index.php
  wp-content/
  images/
  css/
  js/
  .htaccess

Everything a visitor's browser needs to load should sit inside public_html: the homepage file, any subfolders for a CMS like WordPress, images, stylesheets, scripts, and configuration files such as .htaccess that the web server itself reads. If your site uses a subdomain, that subdomain typically gets its own folder, either inside public_html or as a sibling folder, depending on the host.

What should stay outside of it

  • Database credentials or application config files that don't need to be served directly, when your software supports storing them one level above the document root.
  • Source code, build tools or private scripts not meant for public download.
  • Backup archives (.zip, .tar.gz) of the whole site, since leaving one inside public_html means anyone who guesses or finds the filename can download your entire site and database dump.
  • Any file containing passwords, API keys or other secrets.

Anything inside public_html is downloadable by a visitor who knows or guesses the exact file name, unless a server rule specifically blocks it, so sensitive files are safer kept out of that folder entirely.

Finding and accessing the folder

In cPanel, open File Manager and public_html appears as a folder in the account's home directory. Over FTP or SFTP, connecting with your hosting account's credentials usually drops you either directly into public_html or into the home directory one level above it, where public_html is visible alongside other folders like mail and logs. Some hosts and control panels use a different folder name for the same purpose, most commonly www or htdocs, so check your host's documentation if public_html isn't present.

Frequently asked questions

What is the public_html folder used for?

It is the folder a web server treats as the visible root of your site, so any file placed there, or in a subfolder inside it, can be loaded in a browser at your domain name.

Where is my public_html folder located?

It's usually right inside your hosting account's home directory, visible from cPanel's File Manager or immediately after connecting with FTP or SFTP, alongside folders like mail and logs.

What happens if I upload files outside public_html?

Those files are not reachable from the web at all. That makes the space outside public_html a reasonable place for backups or scripts you don't want a visitor to be able to download directly.

Can I rename or move the public_html folder?

Generally no, since the web server's configuration points to that exact folder name for your domain. Renaming it will usually break your site unless a host-specific setting allows a different document root.

Why is my site showing a default page instead of my files?

This usually means your files were uploaded to the wrong folder, left outside public_html, or placed one level too deep inside an extra subfolder instead of directly in public_html.

Is public_html the same thing as www or htdocs?

They serve the same purpose on different software. public_html is the common name on cPanel-based Linux hosting, while www and htdocs are the equivalent document root folder names used by some other hosting setups and local server software.

Related topics