How to disable directory indexes server wide – cPanel/WHM
Is there a simple way to disable directory index?
Sure!! Let us start with “What is “directory index?” This is simply a feature that allows to view all files in a directory via a directory index when there is no index file in that directory. In cPanel/WHM server this feature is enabled by-default.
This is also easy to manage this feature if we have the control panel like cPanel. We can improve the server security by disabling this feature globally. This can be done via server commandline or from the WHM panel.
We already discussed the steps to disable directory index from the server command line for non cPanel server which has Apache web server installed.
You can check our previous article; Steps to disable ‘Directory listing’ in Apache web server.
Here I explaining the steps to disable this via WHM panel, it’s really simple.
Step I : Log into WHM as root.
Step II : Go to Apache Configuration.
Home » Service Configuration » Apache Configuration
Step III : Click on Global Configuration.
Step IV : Move to Directory “/” Options.
Step V : Uncheck Indexes.
Step VI : Save then Rebuild Configuration and Restart Apache.
Disabling directory index / directory listing for a particular cPanel account.
This option is also available on individual cPanel accounts. The main advantage is, we can keep this feature enabled on the server and can easily disable for particular domains or accounts on the server.
Here I’m explaining the steps to manage this feature via individual cPanel.
1. Login to your cPanel.
2. Go to Index Manager (In search box type index manager).
3. The directory list will be shown down. Select the directory you want to turn off directory listing.
4. Select No Indexing and click save.
5. The directory listing will be disabled now.