Search Knowledge Base by Keyword

Understanding the public_html folder

In the realm of web hosting and website management, the term ‘public_html’ can often appear enigmatic. For those new to the world of web development, this term might be perplexing. This post aims to illuminate the importance of the ‘public_html’ folder in website architecture, its function, and why it holds significance.

What exactly is a public_html folder?

The ‘public_html’ folder is a pivotal element within the structure of a web hosting environment. It serves as the designated directory where website files intended for public access are stored. Essentially, any content placed within this folder can be accessed by users through a web browser.

Home Directory

At times, the public_html folder is known as the web root. This designation is commonly found in most web hosting control panels, although it might occasionally be indicated using a slightly varied label. In our illustrative case, the Web root is synonymous with the public_html folder, and this correlation accurately holds true for the cPanel control panel.

This consequently signifies that ‘public_html’ is the directory where files for your primary domain are located. Here, you can place all the website files that belong to your main domain and are meant to be publicly accessible.

Stated differently, whenever an individual accesses your domain (such as, they will have the ability to view the contents of the ‘public_html’ folder.

Where to Find

The ‘public_html’ folder is situated within your File Manager on your cPanel.

Here’s an illustration of the appearance of your file manager directory:


Frequently, the primary file hosted for your domain is named index.html (or any of the other default filenames) in the public_html folder. When accessed, this file will showcase the respective webpage.

Examples of other default pages include:

  1. index.htm
  2. index.php
  3. index.asp
  4. default.html
  5. default.php
  6. default.asp
  7. home.html
  8. home.php
  9. home.asp
  10. welcome.html
  11. welcome.php
  12. welcome.asp

These are some of the common filenames used for default web pages within the public_html folder, covering various scripting languages like PHP and ASP as well. cPanel does not support .ASP pages.

Path in File Manager (or in FTP)*Corresponding URL in a Web Browser

Substitute “” with the primary domain associated with your account. This domain is the one you initially registered when signing up.

Addon Domains & Subdomains

You also have the option to establish subdomains and add-on domains. These will be located within the public_html folder at your selected destination and will function in a manner similar to how the public_html folder serves your primary domain name.


Addon Domain and Subdomain Examples

In this instance, we can establish an Addon domain named It will utilise a subfolder akin to /public_html/ (unless you indicated an alternate preference).

Alternatively, you can generate a Subdomain named, which will utilise a subfolder resembling /public_html/sub/ (unless you specified an alternative arrangement).

Here’s a way to grasp this concept through illustrative examples.

Path in File Manager (or in FTP)*Corresponding URL in a Web Browser

Substitute “” with the primary domain linked to your account (the one you initially signed up with, unless altered). Replace “” with the additional domain you included within the “domains” section of your cPanel. Shared accounts are equipped with a single cPanel, which is why all domains are situated as subfolders within the public_html folder.

Ideal Permissions

Ideally, it’s highly recommended to adhere to specific permission settings for the ‘public_html’ folder, which plays a critical role in your website’s security and accessibility. These permissions ensure that your web content remains safe from potential vulnerabilities while allowing the necessary access for legitimate users.

  1. public_html Folder Permissions (0755): The ‘public_html’ folder itself should consistently maintain 0755 permissions. This means that the owner of the folder has full read, write, and execute permissions (7), while both the group and others have read and execute permissions (5). This arrangement ensures that the web server can access the folder’s contents, allowing users to view your website.
  2. Folder Permissions Within public_html (0755): Every folder contained within the ‘public_html’ directory should uphold 0755 permissions as well. This arrangement ensures that subfolders maintain the appropriate permissions for the web server to access their contents. Just like with the ‘public_html’ folder, the owner can fully manage the folder (read, write, execute), and both the group and others can read and execute.
  3. File Permissions Within public_html (0755 or 0644): All files situated within the ‘public_html’ folder should possess either 0755 or 0644 permissions. For files that need to be executed, like scripts, 0755 permissions are suitable. This provides the owner with full access (read, write, execute) and allows others to read and execute. For files that do not require execution, like images or CSS files, 0644 permissions are appropriate. Here, the owner has read and write access, while both the group and others can read.
  4. Avoid Using 777 Permissions: It’s worth noting that some websites and scripts might suggest using 777 permissions, which grant full read, write, and execute access to everyone. However, this is a security risk as it provides indiscriminate access and can be exploited by malicious actors. Instead, consider employing 755 permissions, which offer the necessary access for your website’s functionality while maintaining a higher level of security.

The complete path is, in fact, /home/username/public_html/ (with “username” representing your cPanel username). However, in most instances, you will come across /public_html/ instead of the entire path. This is because it assumes that you are aware that you are currently within your own home directory.

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.