UnderHost
Knowledgebase Docs

Index files in cPanel: default homepage names

Understand how index.html, index.php, and other default index files work in cPanel hosting, which file loads first,

On this page

An index file is the default page the web server loads when a visitor opens a domain or folder without typing a file name. For example, visiting example.com usually loads public_html/index.php or public_html/index.html.

What is an index file?

When someone visits a directory URL, Apache looks for a default index file in that directory. If it finds one, that file becomes the page visitors see. If it does not find one and directory listing is disabled, the visitor may see a 403 Forbidden error.

Common index file names

File nameCommon use
index.phpWordPress, Laravel front controllers, and PHP applications.
index.htmlStatic HTML websites.
index.htmOlder static HTML sites.
default.htmlOccasional legacy sites; not always first in priority.

Which file loads first?

The server has a configured priority order. On most cPanel hosting, index.php and index.html are the most important names. If both exist in the same folder, one may hide the other depending on server order.

To avoid confusion, keep only the intended homepage file in the document root unless your application specifically requires multiple index files.

Fix common problems

ProblemWhat to check
403 Forbidden on the homepageConfirm an index file exists in the document root and has normal file permissions.
Old page still showsCheck for another index file with higher priority and clear browser/CDN/application cache.
Directory listing appearsAdd an index file or disable indexes in .htaccess.
Wrong site loadsConfirm you uploaded files to the correct document root for the domain.

Advanced DirectoryIndex

If you need a custom default file order, add a DirectoryIndex rule to the site's .htaccess file:

DirectoryIndex index.php index.html home.html

Use this carefully. A bad .htaccess directive can cause a 500 error, so keep a backup before editing.

Related: Advanced .htaccess in cPanel: redirects, PHP settings, and access rules | Redirects in cPanel: create, test, and remove URL redirects | cPanel File Manager: upload, edit, organize, and delete files | How to create and manage addon domains in cPanel | Website changes not showing after upload: cPanel cache checklist

Was this article helpful?

Need cPanel hosting or licensing?

Use UnderHost cPanel hosting or add cPanel/WHM to a VPS or dedicated server for familiar website, email, DNS, and database management.

Related articles

Back to cPanel