Knowledge base
1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!
List the contents of a folder that has no index
This guide explains the "Options +Indexes" directive for Web Hosting, which makes navigation easier for visitors and allows for more advanced customization of how files are displayed.
Introduction
- One of the main advantages of enabling directory indexing is that visitors can view and list all files and subdirectories of 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.
- Directory indexing also makes it easier for visitors who are not familiar with the site's file structure to navigate. They can simply browse the subdirectories to find the file or folder they need.
- The "
Options +Indexes" directive can be customized to display additional information, such as the size and modification date of files, or to hide specific files or directories. - Without this directive, a visitor may encounter an error such as:
Access denied!
You do not have permission to access the requested directory.
Either there are no indexed documents or the directory is protected.
If you believe this is a server error, please contact the site administrator.
Error 403
List the contents of a web folder
To list the items contained in a folder without a specific index:
- Create an .htaccess file in the folder in question.
- Enter the following command:
Options +Indexes
Please note that this solution will only work if there are no index files in the directory in question; you will need to remove the index.php, index.html, index.htm files, etc., as well as any welcome.php file...
Customize the display
Here is an example of 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.htmlIn this example, the user enables the "Indexes" option, adds the "FancyIndexing" option for a more appealing appearance, specifies the file sorting order, defines the column width for the file name and description, and specifies the file names to use for the header and footer of the file list.
Link to this FAQ: https://faq.infomaniak.com/147
Has this FAQ been helpful?