How DirectoryIndex Works on LiteSpeed, cPanel, and CloudLinux
When someone visits a domain or folder like:
the server must decide which file to load first. That decision is controlled by something called DirectoryIndex.
On LiteSpeed servers running with cPanel and CloudLinux, DirectoryIndex determines the default homepage file inside any folder.
What Is DirectoryIndex?
DirectoryIndex is a server directive that defines the priority order of default files.
If multiple “index” files exist in the same directory, the server loads the first match in the configured list.
Example:
If this is the configured order:
And the folder contains:
-
index.php
-
index.html
The server loads index.php because it appears first in the list.
Our Current Default Order
On our LiteSpeed + cPanel servers, the default DirectoryIndex priority is:
index.php8
index.php7
index.php5
index.perl
index.pl
index.plx
index.ppl
index.cgi
index.jsp
index.jp
index.phtml
index.shtml
index.xhtml
index.html
index.htm
index.js
What This Means
If multiple index files exist in the same folder, they load in this priority order:
-
PHP files load before everything else
-
Application files like CGI, Perl, JSP load next
-
index.shtml loads before index.html
-
index.html loads before index.htm
-
index.js loads last
So if a folder contains both:
-
index.shtml
-
index.html
The .shtml file will load first.
Why This Matters
This setting affects:
-
Which homepage visitors see
-
WordPress and PHP application behavior
-
Static HTML vs dynamic PHP conflicts
-
Troubleshooting unexpected homepage loading
If you upload a new index.html file but an index.php file already exists, your HTML file will not display unless the PHP file is removed or renamed.
What Is index.shtml?
.shtml files use Server Side Includes (SSI).
SSI allows you to:
-
Insert headers and footers dynamically
-
Include reusable content blocks
-
Display server information inside HTML
Most modern websites use PHP instead, but SSI is still supported.
How to Change the Priority (Per Account)
If you want HTML to load before PHP or SHTML, you can override the setting inside your account’s .htaccess file:
Example:
Place this in:
This affects only your account.
How to Change the Priority (Server Wide)
Root administrators can adjust this in WHM:
Service Configuration → Apache Configuration → DirectoryIndex Priority
After saving, Apache and LiteSpeed will rebuild the configuration.
When Should You Modify DirectoryIndex?
You might want to change it if:
-
You are switching from PHP to static HTML
-
You are temporarily testing a static landing page
-
A legacy application is loading before your intended homepage
-
You want consistent behavior across multiple sites
For most WordPress or PHP-based websites, the default configuration is recommended.
Need Help?
If your homepage is not loading the file you expect, open a support ticket and let us know:
-
Your domain name
-
Which file you want to load
-
What files currently exist in public_html
We will review and correct the priority safely.