Public_html or public html is the folder that contains all website files that will be shown to a viewer who visits your website. It is located inside your website directories. What makes this different from the rest of the files? All the files in that directory may be publicly accessible, and usually yoursite.com opens the index file in that directory. Other directories (not within the public html) are not accessible through the HTTP scheme. The directory of www. is the shortcut link to the overall public_html directory. So typing in www. is a way of accessing public_html.
Directory permissions, such as Linux permissions, are important to ensure security of your website and all connected files. While permissions may changes based on the configuration of your server, in most circumstances default permissions should be used and are as follows:
- The public_html folder should have permissions of 750. In this case the owner can read, write, and execute, whereas others cannot read, write or execute.
- Folders within the public_html folder should have 755 permissions. Owners can read, write, and execute, and others can read and execute.
- Files within the public_html folder should have 644 permissions. Owners can read and write, others can only read.
WordPress setup folder
All WordPress root directory files, such as core files and code functionalities of installed themes and plugins, should be installed/unpacked into the the public html folder.
What to keep in public_html folder?
As public_html is the folder in which all the files for your main domain are located, keep all of the website files that are part of your main domain here. Whenever a user visits a website, every page viewed loads from the public_html directory, so the folder is where you would keep all website files you want to appear when a user looks up your main domain.
What to keep out of public_html folder?
You should keep the following out of the public html folder: some PHP files, logs, emails (in the case of an email server hosted in the same place), and any other files and scripts that are for service purposes and should not be visible as a part of website content, or be executable by non-admins.
For the security purposes, it’s also always important to make sure that the files and folders outside of public html are not public and that users cannot access them from the web.