Press "Enter" to skip to content

Enable/Disable Directory File Listing (Linux)


Follow the steps below to enable file listing in your Linux package, making the files stored in your subfolders visible:

On Linux hosting packages, Directory Listing (file listing, file browsing, etc) is disabled by default. Because of this, if you would try to access a subfolder of your webspace filled with only pictures (such as, you would likely receive a 404 Error. The 404 error generates because the web server was looking for a default or index page in the images/ subfolder. Since only pictures are saved in this subfolder, the server does not display the list of files but produces an error that no page was found. This is the default action so that no one is able to view a listing of your potentially sensitive web site files should they stumble upon this subfolder.

Sometimes it will be necessary to display the files contained in a folder for easy access (with no login). To enable this, you have to create (or edit an existing) .htaccess file.

The .htaccess file is a file where you can add some configuration for the web server. The .htaccess file is recursive meaning the configuration within the file will apply to the folder where it is saved as well as subfolders.

Enable Directory Listing
To enable Directory Listing, create a .htaccess (or edit an existing one) and add the following text below on a new line.

Options +Indexes

Disable Directory Listing
To disable Directory Listing, remove the above line from the relevant .htaccess file. To force disable the Directory Listing (such as in a subfolder where the parent folder already has Directory Listing enabled), add the line below to your .htaccess file.

Options -Indexes

Save the .htaccess file in the folder where you want the files publicly listed. If you are creating/editing the file on a Windows machine, use a basic text editor like Wordpad or Notepad. Save the file as htaccess.txt first and then upload the file to the correct folder. Once uploaded, you can then rename the file to .htaccess.

Leave a Reply

Your email address will not be published. Required fields are marked *