Directory listing is disabled by default in most servers for security purposes. You can disable/enable the directory listing option from the Apache configuration. You can improve the server security by disabling this feature globally.
What you’ll need
- Before you begin this guide you’ll need the following:
- Access to your account’s WebHost Manager (WHM)
Method 1: Steps to disable directory listing via WHM panel
1) Login to WHM.
2) Click “Service Configuration”.
3) Select Apache configuration.
4) Navigate to Global Configuration.
5) Untick Indexes option in “Directory ‘/’ Options”.
6) Click the Save button.
7) Rebuild Apache conf.
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.
Method 2: Disable Directory Browsing via SSH
1) Login to server via SSH
2) Open httpd.conf
3) Search “Options” and Remove the word ‘Indexes ‘from options
“Options ExecCGI FollowSymLinks IncludesNOEXEC Indexes SymLinksIfOwnerMatch
Options Includes Indexes FollowSymLinks”
4) Restart Apache
# service httpd restart
disable/enable the directory listing option from the Apache configuration. You can improve the server security by disabling this feature globally