I want to disable directory browsing of /galerias folder and all subdirectories
Index of /galerias/409
* Parent Directory * i126937298
Edit/Create an .htaccess
file inside /galerias
with this:
Options -Indexes
Directory browsing is provided by the mod_autoindex module.
If you choose to modify your httpd.conf file to solve this and you have multiple Options directives, then you must add a - or a + before each directive. Example:
Options -Indexes +FollowSymLinks
You can place an empty file called index.html
into each directory that you don't want listed. This has several advantages:
.htaccess
files, this can lead to lots of "Error 500 - internal server error" messages for your users!). Theoretically, the autoindexing might be triggered by a different file (this is controlled by the DirectoryIndex
option), but I have yet to encounter this in the real world.
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.)
Open Your .htaccess file and enter the following code in
Options -Indexes
Make sure you hit the ENTER key (or RETURN key if you use a Mac) after entering the "Options -Indexes" words so that the file ends with a blank line.
Try this in .htaccess
:
IndexIgnore *.jpg