How to enable directory listing on webserver?

On Friday August 24, 2012, ITS turned off the directory listing as the default setting on the www.unc.edu webserver configuration. The impact of this change is that the public_html directories underneath www.unc.edu or aliased by www.unc.edu, that DO NOT have an index.html or index.htm files will no longer display a listing of the directory contents.  This change WILL NOT affect the display of webpages or websites — it will simply make the _directories_ unavailable to browse by default.

If you want to override this setting, then:

  1. Create a file named “.htaccess” in the directory you want to list or edit an existing file.
  2. Place the following line in that .htaccess file
    Options +Indexes
  3. Save the file.

In order to create an htaccess file, please do the following:

  • Open a Text Editor (Notepad on Windows or TextEdit on Mac).
  • Save the File as htaccess (This will save as a text file, which will be renamed).
  • Copy and Paste the line from option 2 above.
  • Save the file.
  • Using an SFTP (SSH Secure Shell – Secure File Transfer Client for Windows or Fetch for Mac) client upload your htaccess.txt file to the public_html folder or folder that you want to enable the directory listing.
  • Once placed in the correct folder please rename the file using the SFTP client to “.htaccess” by placing a period in front of htaccess and removing the “.txt“.