Public_html Folder and how it works

public_html folder

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

This means that public_html is the folder where you put all website files which you want to appear when someone types your main domain (the one you provided when you signed up for hosting).

Or put another way, when someone types your domain name into their browser, whatever is in the public_html folder is what will be shown to them.

Examples

For example, if you have a file called index.html(or any of the other default filenames) in the public_html folder, it will display that page.

If you do no have a default file in the public_htmlfolder (such as index.html, default.html, etc.), then a list of files in the public_html folder will be shown.

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

Replace yourdomain.com with the primary domain on your account (the one you originally signed up with, unless you changed it).


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).

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

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

Path in File Manager (or in FTP)*Corresponding URL in a Web Browser
/public_html/gatorhost/ http://digihost.yourdomain.com/
/public_html/addondomain.com/ http://www.addondomain.com/

Replace yourdomain.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.

If you do not want additional domains to be subfolders of public_html, then reseller, VPS or dedicated hosting is a better solution, since you can put each domain in its own cPanel to keep it separate from other domains. Shared accounts only get one cPanel, which is why all addon domains are subfolders of the public_htmlfolder.

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, our servers are configured to use 755 for the same purpose instead, since it is more secure. Permissions of 777 on any file or folder will cause the file to be inaccessible. Use 755 instead of 777.


*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.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

WordPress pointing home URL to subdirectory

Pointing your home site's URL to a subdirectory In some cases, you may have a WordPress site...

How to log into cPanel

cPanel is a web hosting account management tool available on all Digicom Linux hosting plans,...

Change cPanel Password or recover lost password

Requesting a New cPanel Password If you have lost or forgotten your cPanel password, you can...

Location of Script Configuration Files

Location of Script Configuration Files These paths are relative to the root of the script, not...

Connect to MySQL Database

How to Connect to the MySQL Database In order for your MySQL database to work as intended, it...