Loading...

Knowledge Base

Linux Directory Structure and Default Index Files in cPanel (Document Root & Homepage Files)

When you want to understand where website files are stored and how default homepage files work in your cPanel hosting account, this article explains the Linux directory structure, including the document root (/public_html), and how index files are prioritized to display your website’s home page.

 

Directory/Folder Structure

From amongst the several directories found within your cPanel account, only the following are important:

DirectoryContents
/public_htmlContains all files that are part of the website. Any file or folder inside this directory is visible over the Internet unless you password protect it.
/wwwIs simply a link to the public_html directory.

File Structure

Our cPanel hosting servers will check for the existence of one of the following files and, based on the order specified below, display its content as the Home Page when anyone tries to list the content of any folder/directory:

  1. index.html
  2. index.htm
  3. index.php
  4. index.php3
  1. index.php4
  2. index.shtml
  3. default.html
  4. default.htm
  1. default.php
  2. home.html
  3. home.htm
  4. home.php
  1. index.pl
  2. home.pl
  3. default.pl

Examples

If you were to upload a file index.html within the public_html folder of your website somedomain.com, then when someone tries to reach either somedomain.com or www.somedomain.com, then they would be automatically displayed the content of the index.html file. This happens since our server treats the index.html as the home page or default page for this directory.

Similarly, if you were to upload an index.html file within the /public_html/plants folder, then when someone types somedomain.com/plants or www.somedomain.com/plants, they would automatically display the content of the index.html file within the plants folder.

Now, if you were to upload two or more files from amongst the list given above, then the one mentioned higher in the order would be considered as the home page. So in the event that there exists an index.php and default.html file within the same folder, then the index.php file will get considered as the home page.