We can disable directory listing in our apache webserver.
Open httpd.conf file
In centos:
#vi /etc/httpd/conf/httpd.conf
In ubuntu:
#vi /etc/apache2/apache2.conf
Now change the line under Directory module:
Options Includes Indexes FollowSymLinks MultiViews
to
Options Includes FollowSymLinks MultiViews
Now save the file and restart httpd service.
#service httpd restart (Centos)
#service apache2 restart(Ubuntu)
But this is valid only when AllowOverride is None.That means when .htaccess file have no right over configuration.
When AllowOverride module is set to All,Go to perticular directory where we want to disable listing.Create a .htaccess file there
#vi .htaccess
Options -Indexes
This will disable the directory listing.(Major advantage of .htaccess is that we don’t want to restart service after placing .htaccess file)
Open httpd.conf file
In centos:
#vi /etc/httpd/conf/httpd.conf
In ubuntu:
#vi /etc/apache2/apache2.conf
Now change the line under Directory module:
Options Includes Indexes FollowSymLinks MultiViews
to
Options Includes FollowSymLinks MultiViews
Now save the file and restart httpd service.
#service httpd restart (Centos)
#service apache2 restart(Ubuntu)
But this is valid only when AllowOverride is None.That means when .htaccess file have no right over configuration.
When AllowOverride module is set to All,Go to perticular directory where we want to disable listing.Create a .htaccess file there
#vi .htaccess
Options -Indexes
This will disable the directory listing.(Major advantage of .htaccess is that we don’t want to restart service after placing .htaccess file)