Do you have WHM access to your server? Then it’s simple, do the steps in >> disable directory indexes server wide – cPanel/WHM <<

Disabling the directory listing option in Apache web server will improve the total server security and also it will reduce the chance of server hack. We can do it from the Apache configuration file itself. Enabling this feature lists all files and folders in a directory on the web browser when there is no index file on that particular directory. Here I’m explaining the steps to edit Apache configuration file to disable directory index option.

If you have a control panel like cPanel, you can manage it simply from the panel itself, that we already discussed.

Open your Apache conf file with your favorite editor and make the changes as pasted below:

Steps to disable directory listing/indexes

Step 1 : SSH to server as root.

Step 2 : To check, run this:

# grep Options /etc/httpd/conf/httpd.conf

Sample output:

# grep Options /etc/httpd/conf/httpd.conf
    Options ExecCGI FollowSymLinks IncludesNOEXEC Indexes SymLinksIfOwnerMatch
    Options Includes Indexes FollowSymLinks
    Options None

Step 3 : Open the Apache configuration file, remove the word ‘Indexes‘ from options then save it and restart the Apache service.

# service httpd restart

That’s it!! Now check the directory via web browser you can see the change.


1. Yes I know this, but I have WHM on my server. How disable directory indexes server wide via WHM panel?

This is also simple, this can be done from Home » Service Configuration » Apache Configuration » Global Configuration. Read this article for more details >> How to disable directory indexes server wide – cPanel/WHM <<

2. I want to disable this feature only for one account in my WHM server, is it possible?

Yeah, it’s. Please read this article, for cPanel. Ping me, if you need any help.