Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable directory browsing?

I want to disable directory browsing of /galerias folder and all subdirectories

Index of /galerias/409

* Parent Directory * i1269372986681.jpg * i1269372986682.jpg * i1269372988680.jpg 
like image 633
arthurprs Avatar asked Mar 27 '10 18:03

arthurprs


People also ask

What does disabling directory browsing do?

This means all the files and folders inside the directory are on display! Most web servers are configured to not display the contents of your directory (or directory listing as it is often referred to).

Why am I getting a directory listing instead of my site?

If you are expecting to see an existing site however, and instead you see the directory listing something has gone wrong somewhere. The file may have been infected via a php injection attack and removed by a malware scanner. The site may have been attacked. Your account password may not be very secure.


1 Answers

Create an .htaccess file containing the following line:

Options -Indexes 

That is one option. Another option is editing your apache configuration file.

In order to do so, you first need to open it with the command:

vim /etc/httpd/conf/httpd.conf 

Then find the line: Options Indexes FollowSymLinks

Change that line to: Options FollowSymLinks

Lastly save and exit the file, and restart apache server with this command:

sudo service httpd restart 

(You have a guide with screenshots here.)

like image 192
michiel Avatar answered Sep 23 '22 08:09

michiel