Have you ever needed to have some files on your server available to the general public? Perhaps some useful downloads that you’ve created for your clients and potential clients? But, you don’t want everyone to be able to see the entire directory willy nilly.

Here’s how to prevent the whole directory from showing (called indexing of a directory) but still allow public access to files:

  1. First, open up a plain text document (notepad on a PC or TextEdit on a Mac)
  2. Copy and paste this little bit of html
  3. <html>
    <head>
    <title>403 Forbidden</title>
    </head>
    <body>
    <p>Directory access is forbidden.</p>
    </body>
    </html>

  4. Save the file as index.html
  5. Upload this new index.html file to the folder that you want to prevent from being indexed, and voila!  Done!

A super simple solution.