Understanding the public_html Folder

Follow

public_html folder

The public_html folder is the web root for your primary domain name.

This means that the public_html folder is the location where you put all your website files which you want to appear when someone visits your primary domain.

Example

If you have a file called index.html, index.php or any other valid, default file name in the public_html folder, it will display that page.

If you do no have a valid default file in the public_html folder such as those listed above, a list of contents in the public_html folder will be displayed. 

Replace domain.com in above table with the primary domain on your account.


Addon Domains & Subdomains

You can also create Addon domains and Subdomains, and these will use a folder inside public_html. 

Examples

You can create an addon domain called addondomain.com and it will use a subfolder similar to /public_html/addondomain.com (unless you specified otherwise when setting the addon domain up).

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

If forums.domain.com is defined as a subdomain, and addondomain.com is defined as an addon domain, then the following examples apply:

Replace domain.com with the primary domain on your account. Replace addondomain.com with the name used when creating the additional domain within cPanel in the addon domains section.


Permissions

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, it is recommended that they be configured as 755 since it is more secure.  


Additional Information

The full path is for the public_html folder is actually /home/username/public_html where username is replaced by your cPanel username.

Have more questions? Submit a request

Comments

Powered by Zendesk