What is Public html directory

Apache web servers store all web content, including HTML files, in a directory called public html. Whenever a user accesses a website online, each page is retrieved from the public html directory.

The directory that houses all the files of a website visible to visitors is commonly referred to as public html or public_html. This directory resides within the website's directories. What sets this directory apart from others is that the index file within it is usually what opens when yoursite.com is accessed, making all files within this directory potentially accessible to the public. It's important to note that the HTTP protocol restricts access to directories beyond the public html. The www directory acts as a convenient link to the entire public html directory, simplifying access by requiring users to type www.

Permissions for public html :

Ensure that the public html folder is configured with 0750 permissions. Inside the public html folder, set 0755 permissions for each subfolder. Files within the public html folder should have permissions of either 0755 or 0644.

To guarantee the security of your website and all associated data, directory rights, such as Linux permissions, are crucial. Although permissions may vary depending on how your server is configured, in most cases, the following default permissions should be used:

  • The public html folder needs to have 750 permissions . In this instance, only the owner is able to read, write, and execute; everyone else is unable to do any of these things.
  • The public html folder should have 755 permissions for all of its subfolders. In addition to others being able to read and execute, owners can also write and read.
  • The permissions for files in the public html folder should be 644 . Owners are literate (readers and writers), while others are not.
  • What should store in the public html folder?

It is essential to store all files associated with your primary domain within the "public html" directory on your server. This folder houses all the files related to your main domain, and every webpage accessed by users is loaded from this directory. Therefore, any website files that you wish to be visible when users search for your primary domain should be kept in the "public html" directory.

What should be kept out of public html?

It is important to ensure that the public html directory does not include the following items: PHP files, log files, emails (especially if an email server is being hosted within that directory), or any other files or scripts intended for service operations that should not be visible as part of the website's content or executable by non-admin users. To enhance security measures, it is equally vital to restrict users from accessing any files or directories beyond the public html directory and to ensure that these files are not publicly accessible.

How is the public html folder accessed?

You can access the public html folder via the cPanel interface . For information on how to access your public html folder from your cPanel account , please refer to the instructions listed below.

  • Enter your cPanel login
  • Go to Files >> File Manager by selecting it.
  • The public html folder is visible on your File Management
  • Extra Domains &Subdomains:

Additionally, you have the option to create subdomains and addon domains, which will utilize a subdirectory within the public HTML directory.

Examples:

You have the option to establish an Addon domain named addondomain.com by utilizing a subfolder labeled /public html/addondomain.com/ unless you specify a different path. Another approach is to generate a Subdomain named gatorhost.example.com and associate it with a subfolder such as /public html/gatorhost/.

The provided instances are relevant when addondomain.com is set as an additional domain and gatorhost.example.com is designated as a subdomain:

Replace logic-practice.com with the primary domain associated with your account, which is the initial one used during the signup process unless it has been altered. The additional domain that was included in the "addon domains" category within cPanel should be swapped with addondomain.com.

Opting for a reseller, VPS, or dedicated hosting is recommended as it allows you to maintain individual domains within their respective cPanels, ensuring segregation from other domains if you prefer not to have them as subfolders of public html. In contrast, shared accounts are limited to a single cPanel, leading to all addon domains being situated within the public html subdirectory.

Input Required

This code uses input(). Please provide values below: