If you create a new directory (or folder) on your website, and do not put an “
index.html” file in it, you may be surprised to find that your visitors can get a directory listing of all the files in that folder. For example, if you create a folder called “
test“, you can see everything in that directory simply by typing “
http://www.example.com/test/” in your browser. No password or anything is needed.
But you can configure your web server so that it does not show a directory listing by default.
- Your Website Must Be on an Apache Web Server
- Your Web Host Must Have Enabled .htaccess Server Overrides
Add the following line to your
Make sure you hit the ENTER key (or RETURN key if you use a Mac) after entering the “Options -Indexes” words so that the file ends with a blank line.