1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
List the contents of a folder that does not have an index
This guide explains the Directive "Options +Indexes
" for the Web hosting, which facilitates browsing for visitors and allows for further customization of how files are displayed.
Preamble
- One of the main benefits of activating directory indexing is that visitors can view and list all files and subdirectories in a given directory, even if they do not know the exact name of the file they are looking for. This can be particularly useful for file sharing websites or download sites.
- Indexing directories also facilitates browsing for visitors who are unfamiliar with the site's file tree. They can simply navigate through subdirectories to find the file or folder they need.
- The Directive "
Options +Indexes
"can be customized to display additional information, such as file size and modification date, or to hide specific files or directories. - Without this directive, a visitor may encounter an error of type:
Accès interdit!
Vous n'avez pas le droit d'accéder au répertoire demandé.
Soit il n'y a pas de document index soit le répertoire est protégé.
Si vous pensez qu'il s'agit d'une erreur du serveur, veuillez contacter le gestionnaire du site.
Error 403
List Web Folder Content
To list the elements contained in a folder without a particular index:
- Create a .htaccess file in the file in question.
- Enter the following order:
Options +Indexes
Note that this solution will only work if you have no indexes in the directory in question; you need to remove the files index.php
, index.html
, index.htm
, etc. but also the possible file welcome.php
…
Customize View
Here is an example code to customize the appearance of the file list generated by Apache:
Options +Indexes
IndexOptions FancyIndexing
IndexOptions FoldersFirst IgnoreCase NameWidth=* DescriptionWidth=* Charset=UTF-8
HeaderName header.html
ReadmeName footer.html
In this example, the user activates the option "Indexes
", adds the option "FancyIndexing
"for a more aesthetic appearance, specifies the order of sorting the files, sets the width of the columns for the name and description of the files, and specifies the names of the files to be used for the header and footer of the file list.