---
title: "Disable directory indexes server wide"
description: "By default Apache's DirectoryIndexes value is turned on server wide. This allows the files in a folder to be viewed via a directory index when there is no index file present in that directory. If you..."
url: https://www.inmotionhosting.com/support/edu/whm/disable-directory-indexes-server-wide/
date: 2012-11-05
modified: 2021-08-16
author: "InMotion Hosting Contributor"
categories: ["WebHost Manager (WHM)"]
type: post
lang: en
---

# Disable directory indexes server wide

By default Apache’s DirectoryIndexes value is turned on server wide. This allows the files in a folder to be viewed via a directory index when there is no index file present in that directory.

If you happen to have read our previous article on [how to pass PCI compliance scans](/support/security/how-to-pass-pci-scans/), leaving DirectoryIndexes on is a common way to fail a PCI scan. In this article we’ll walk you through disabling this server wide on your server, please note that this would require [root access](/support/server/ssh/root-access-faq/) to your server.

1. [Log into WHM](/support/edu/whm/log-into-whm/)
2. In the top-left **Find** box enter in **Apache**, then click on **Apache Configuration**. [![whm-click-on-apache-configuration](https://www.inmotionhosting.com/support/wp-content/uploads/2012/11/website_website-troubleshooting_pci-compliance_whm-click-on-apache-configuration.png)](/support/wp-content/uploads/2012/11/website_website-troubleshooting_pci-compliance_whm-click-on-apache-configuration.png)
3. Click on **Global Configuration**. [![whm-click-on-apache-global-configuration](https://www.inmotionhosting.com/support/wp-content/uploads/2012/11/website_website-troubleshooting_pci-compliance_whm-click-on-apache-global-configuration.png)](/support/wp-content/uploads/2012/11/website_website-troubleshooting_pci-compliance_whm-click-on-apache-global-configuration.png)
4. Scroll down to the **Directory “/” Options** section, then un-check **Indexes**. [![whm-un-check-apache-indexes](https://www.inmotionhosting.com/support/wp-content/uploads/2012/11/website_website-troubleshooting_pci-compliance_whm-un-check-apache-indexes.png)](/support/wp-content/uploads/2012/11/website_website-troubleshooting_pci-compliance_whm-un-check-apache-indexes.png)
5. Scroll down to the bottom of the page and click on **Save**.
6. Finally click on **Rebuild Configuration and Restart Apache**, Apache can take up to a few minutes to rebuild and during this time your websites won’t respond to requests. [![whm-click-on-rebuild-configuration](https://www.inmotionhosting.com/support/wp-content/uploads/2012/11/website_website-troubleshooting_pci-compliance_whm-click-on-rebuild-configuration.png)](/support/wp-content/uploads/2012/11/website_website-troubleshooting_pci-compliance_whm-click-on-rebuild-configuration.png)
7. You should see that Apache was successfully restarted now. [![whm-apache-successfully-restarted](https://www.inmotionhosting.com/support/wp-content/uploads/2012/11/website_website-troubleshooting_pci-compliance_whm-apache-successfully-restarted.png)](/support/wp-content/uploads/2012/11/website_website-troubleshooting_pci-compliance_whm-apache-successfully-restarted.png)
8. Now when you try to browse to a directory that doesn’t have an index file, you’ll receive an error instead of a directory listing. [![directory-listing-on-example](https://www.inmotionhosting.com/support/wp-content/uploads/2012/11/website_website-troubleshooting_pci-compliance_directory-listing-on-example.png)](/support/wp-content/uploads/2012/11/website_website-troubleshooting_pci-compliance_directory-listing-on-example.png) [![directory-listing-off-example](https://www.inmotionhosting.com/support/wp-content/uploads/2012/11/website_website-troubleshooting_pci-compliance_directory-listing-off-example.png)](/support/wp-content/uploads/2012/11/website_website-troubleshooting_pci-compliance_directory-listing-off-example.png)

You should now know how to disable Apache’s DirectoryIndex setting server wide on your server. This can help increase security by ensuring a directory that doesn’t include an index file isn’t exposing any other possibly sensitive files.
