Search Knowledge Base by Keyword

Understanding the public_html folder

What exactly is a public_html folder?

Home Directory

We have discussed about what exactly is the web root. Web root is also referred to as the public_html folder.

This therefore means that public_html is the folder where files for your main domain rests. You can put all website files which are a part of your main domain.

In other words, whenever someone visits your domain (say example.com), they will be able to see files in the public_html folder.

Where To Access

public_html folder is located inside your File Manager in your cPanel.

Here is a view of how your file manager folder looks like

Examples

Quite often, the main file hosted for your domain is titled as index.html (or any of the other default filenames) in the public_html folder, and it will display that page.

Path in File Manager (or in FTP)*Corresponding URL in a Web Browser
/public_html/http://www.ukhost4u.com/
/public_html/pagename.htmlhttp://www.ukhost4u.com/pagename.html
/public_html/folder/http://www.ukhost4u.com/folder/
/public_html/folder/page.htmlhttp://www.ukhost4u.com/folder/page.html

Replace ukhost4u.com with the primary domain on your account. This would be the one that you’d have originally signed up with.
 


Addon Domains & Subdomains

You can also create sub-domains and add on domains. These will rest inside the public_html folder.
 

Examples

Addon Domain and Subdomain Examples

You can create an Addon domain called ukhost4u.com and it will use a subfolder similar to /public_html/ukhost4u.com/ (unless you specified otherwise).

Or you could create a Subdomain called ukhost4u.example.com and it would use a subfolder similar to /public_html/ukhost4u/ (unless you specified otherwise).

Here is how you can understand this entire thing using examples

Path in File Manager (or in FTP)*Corresponding URL in a Web Browser
/public_html/ukhost4u/http://ukhost4u.example.com/
/public_html/ukhost4u.com/http://www.ukhost4u.com/

Replace example.com with the primary domain on your account (the one you originally signed up with, unless you changed it). Replace addondomain.com with the additional domain you added in the “addon domains” section of cPanel. Shared accounts only get one cPanel, which is why all addon domains are subfolders of the public_html folder.


Ideal Permissions

Ideally,

  • the public_html folder should always have 0750 permissions.
  • All folders inside the public_html folder should have 0755 permissions
  • All files inside the public_html folder should have 0755 or 0644 permissions.

Some websites and scripts may advise you to use 777 permissions, however, 755 permission can be used for the same purpose instead, since it is more secure. 


*The full path is actually /home/username/public_html/ (where username is your cPanel username) rather than /public_html/ but in most places you will see /public_html/ instead of the full path, since it assumes you know you are in 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.