Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the htaccess Options -Indexes for?

Tags:

.htaccess

I looked at the explanation in the apache.org site but it didn’t explained in a way I can understand. I found some info here .htaccess File Options -Indexes on Subdirectories but it doesn’t explain it either.

like image 991
Samuel Ramzan Avatar asked Apr 05 '13 15:04

Samuel Ramzan


People also ask

What is htaccess and why we use this?

htaccess is a configuration file for use on web servers running on the web apache server software. when a . htaccess file is placed in a directory which in turn loaded via the Apache web server, then the . htaccess file detected and executed by the Apache server software.

When should I use htaccess?

The . htaccess file is commonly used when you don't have access to the main server configuration file httpd. conf or virtual host configuration, which only happens if you have purchased shared hosting. You can achieve all of the above-mentioned use cases by editing the main server configuration file(s) (e.g., httpd.

Is .htaccess necessary?

The . htaccess is not required for having a general website. That file simply allows you to make changes in the way your website behaves for example banning people from accessing your site or redirecting an old dead link to a new page.

What does the .htaccess command options indexes do?

The Indexes option sets whether you can "browse" the directory or not. If indexes is set to plus, and the directory has no index. html or index. php (of whatever) file, it will show the contents of the directory just like your filemanager would do.


2 Answers

The Indexes option sets whether you can "browse" the directory or not. If indexes is set to plus, and the directory has no index.html or index.php (of whatever) file, it will show the contents of the directory just like your filemanager would do. So if there are ten images in there, it simply shows them as a list with links to the actual image. You can click them and open them.

Most of the time this is not what you want. You don't want others to see what is inside that folder. So then you turn it off with -Indexes.

Here you can see an example of an open dir, as they are called: http://www.ecoutetpartage.fr/images/

like image 126
SPRBRN Avatar answered Oct 14 '22 11:10

SPRBRN


-Indexes supresses the possibilty of directly listing files in a directory where no DirectoryIndex is set.

Assume a httpd DirectoryIndex set to: DirectoryIndex index.html index.php.

If you have no file in your RootDirectory according to the DirectoryIndex httpd (in this example index.html and index.php) variable, your directory contents will be listed when +Indexes ist set. Your directory contents will never be displayed when -Indexes is set.

like image 24
Dirk Thannhäuser Avatar answered Oct 14 '22 13:10

Dirk Thannhäuser