DirectoryIndex Priority

Valid for versions 82 through the latest version


Last modified: November 30, 2022

Overview

Visitors see the index page by default when they access a directory (for example, index.html). The DirectoryIndex Priority interface allows you to specify the filenames that Apache recognizes and displays as index pages. You can also set the priority in which Apache selects an index page if more than one of these filenames appears in a directory.

To perform these actions, the system modifies the /usr/local/apache/conf/httpd.conf file. For example, if you configure the system to display the index.php file, the system adds the following line:

1
DirectoryIndex index.php

Add a new filename

To add a new filename to the list of index pages that Apache recognizes, perform the following steps:

  1. Click Add.
  2. Enter the name of the index file that you wish to add (for example, index.nick).
  3. Click OK.
  4. Click Save.
  5. Click Rebuild Configuration and Restart Apache to configure Apache to use the new DirectoryIndex settings.
    • To restart Apache later, use WHMs HTTP Server (Apache) interface (WHM » Home » Restart Services » HTTP Server (Apache)) or run the /scripts/restartsrv_httpd command via SSH as the root user.

Remove a filename

To remove filenames from the list of index pages that Apache recognizes, perform the following steps:

  1. In the available menu, select the index file or files that you wish to remove.
  2. Click Remove.
  3. Click Save.
  4. Click Rebuild Configuration and Restart Apache to configure Apache to use the new DirectoryIndex settings.
    • To restart Apache later, use WHMs HTTP Server (Apache) interface (WHM » Home » Restart Services » HTTP Server (Apache)) or run the /scripts/restartsrv_httpd command via SSH as the root user.

Set index page name priority

Filenames that the interface displays higher in the menu have a higher priority than names that are lower in the menu.

To reorder the priority of index page names that Apache recognizes, perform the following steps:

  1. In the available menu, select the index file that you wish to move up or down in priority.
  2. Click Move Up or Move Down to change the filenames order.
    • For example, if you want index.html to appear instead of index.php, select index.html from the menu and click Move Up until index.html is higher in the menu than the index.php entry.
  3. Click Save.
  4. Click Rebuild Configuration and Restart Apache to configure Apache to use the new DirectoryIndex settings.
    • To restart Apache later, use WHMs HTTP Server (Apache) interface (WHM » Home » Restart Services » HTTP Server (Apache)) or run the /scripts/restartsrv_httpd command via SSH as the root user.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Apache Configuration

Valid for versions 82 through the latest version Last modified: September 29, 2020...

cPanel Log Rotation Configuration

Valid for versions 82 through the latest version Last modified: May 6, 2021 Overview...

cPanel Web Disk Configuration

Valid for versions 88 through the latest version Last modified: August 9, 2022...

cPanel Web Services Configuration

Valid for versions 88 through the latest version Last modified: August 9, 2022...

Exim Configuration Manager

Valid for versions 102 through the latest version Last modified: November 30, 2022...