How to hide Index of /


How do i hide the index of / but allow them to access the site?


The command is

Options -Indexes

and you either put it in your .htaccess or in the server configuration file. The rule applies to all subdirectories too, so if you want to enable Index of some other directory, you will have to place an .htaccess in it with “Options +Indexes”.


To expand on @s0099’s suggestion, you can also set the path / to an HTML file, using the following in your HTML file:

DirectoryIndex  myfile.html

When a user navigates to /, they will see the page stored in myfile.html.