How do I disable directory browsing?

When I access the site I see all the file names. I don’t have an index.html file in the directory and don’t want to create one in there. What other way can I protect the directory to stop people from viewing all my files?

  • You can disable the browsing of directories using the control panel, uploading a blank index.html file or by modifying an .htaccess file on a directory.

  • To modify using the control panel: Access your cPanel and click on Index Manager. Next click on the folder you wish to disable the indexing on. The Index Manager will automatically create an .htaccess file for you within that folder.
  •  You can also upload just a blank or generic index.html file. The index file is the first file that will show by default when a user accesses a directory. This method will prevent the user from seeing an error.

  • To modify using an .htaccess file: To disable directory browsing using an .htaccess file. Open up a text editor and put the following line in it:
    Options -Indexes
    Now select Save As… from the menu and select “All files”‘ in the Save As type before typing a filename. For the filename type “.htaccess” (without quote marks and remember the dot at the start). Upload the file to your public_html directory (or other directories) and the browsing of directories on your account will be disabled.

 

Rate This Article

(11 out of 22 people found this article helpful)

Leave A Comment?