Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to Set DirectoryIndex Priority in WHM

DirectoryIndex sets which file opens first in a folder. This guide shows how to change that order in WHM.

Webuzo2 min read10 steps4 screenshots

This guide needs root access. Root access means full control of the server. VPS and dedicated server customers have it.

What is WHM?

WHM stands for WebHost Manager. It is the admin panel that goes with cPanel. cPanel is for single websites. WHM is for the whole server.

What is DirectoryIndex?

When someone visits a folder, the server looks for a home page file. It checks a list of names in order. The first match is shown. Common names are index.html, index.php and index.htm. The order of that list is the priority.

If an old index.html sits first, it can hide your new index.php. Changing the order fixes that for all sites on the server.

Steps

  1. Log in to WHM as root. The address and login are in your server welcome email.
    Screenshot: Log in to WHM as root. The address and login are in your server welcome email.
  2. In the search box at the top left, type Apache Configuration.
  3. Click Apache Configuration.
    Screenshot: Click Apache Configuration .
  4. Click DirectoryIndex Priority.
  5. You will see a list of file names. Each one has a priority number.
  6. Change the order. The file at the top is checked first.
  7. Type or edit file names if you need to add one, such as index.php.
  8. Click Save.
  9. WHM may ask you to rebuild the Apache config. Confirm it and wait for the finish message.
  10. Visit a site on the server and confirm the right page opens.
Tip: Menu labels can differ slightly between WHM versions. Use the search box if you cannot find it.

Warning

This change affects every website on the server. A wrong order may show the wrong page. Note down the old order before you edit so you can put it back.

Single site option

If you only want to change one website, add this line to its .htaccess file instead.

DirectoryIndex index.php index.html

This makes only that site try index.php before index.html.

Quick recap

  • DirectoryIndex is the order of home page file names.
  • In WHM go to Apache Configuration, then DirectoryIndex Priority.
    Screenshot: In WHM go to Apache Configuration , then DirectoryIndex Priority .
  • Reorder, save and rebuild if asked.
    Screenshot: Reorder, save and rebuild if asked.
  • It affects all sites on the server.