Can I create private directory listings?

This page is showing a generic answer.
To see a more detailed answer customized for you, type your domain name here:

We have a page explaining how to display a listing of files for every visitor to a certain directory or folder URL address, which is a common request.

A more unusual request is “How can I see a directory listing, even though other people don’t see it?”

Technically advanced customers can do this by creating a separate, new password-protected directory that contains these two htaccess file lines:

Options +Indexes
DirectoryIndex disabled

Then within that new directory, use the command-line shell to create a symlink to the directory or directories you want to show listing for (which can even include the top level of your web site).

An example will probably help. Let’s say you want to have a way to view a directory listing of all your Web site files. You could use these commands after logging in to the shell:

cd html
mkdir private-listings
cd private-listings
echo "Options +Indexes" >> .htaccess
echo "DirectoryIndex disabled" >> .htaccess
ln -s ../ all-files

Then password protect the “private-listings” directory.

After that, visiting http://example.com/private-listings/all-files/ will show you a directory listing of every file on your site.

Note that this setup will still run PHP script files as PHP programs, instead of showing you their source code or downloading them. If you want to change that, you could add this line to the .htaccess file:

AddHandler default php cgi      

This will show you the source code of all files ending with “.php” and “.cgi” (which is a security risk: be very sure you’ve successfully password protected your directory to ensure hackers can’t view the source code of your files, which may contains passwords and other private information).