Enabling and disabling directory index listings via .htaccess
Ce contenu n’est pas encore disponible dans votre langue.
By default, Apache servers on ruachost.com do not display directory listings for security reasons. Instead, visitors see a 403 Forbidden error if a directory has no index page. You can override this behavior using the .htaccess file.
Why Control Directory Index Listings?
Section titled “Why Control Directory Index Listings?”- Enable listings when you want visitors to browse files in a directory (e.g., downloads).
- Disable listings to prevent unauthorized users from seeing file structures.
- Provides flexibility for developers and administrators.
Enabling Directory Index Listings
Section titled “Enabling Directory Index Listings”To allow visitors to see file listings in a directory:
-
Open or create the
.htaccessfile in the directory. -
Add the following directive:
Options +Indexes -
Save the file.
-
Reload the site — the directory will now display a list of files.
???? You can also enable fancy indexing (shows filenames, sizes, and modification dates):
IndexOptions +FancyIndexingDisabling Directory Index Listings
Section titled “Disabling Directory Index Listings”Directory listings are disabled by default, but if you previously enabled them, you can turn them off:
-
Open the
.htaccessfile. -
Add the following directive:
Options -Indexes -
Save the file.
-
Visitors will now see a 403 Forbidden error instead of file listings.
To disable fancy indexing but keep standard indexing:
IndexOptions -FancyIndexingCette page vous a-t-elle aidé ?
Merci pour votre retour.