Making directories browsable, solving 403 errors
This article will illustrates how to allow the browsing of directories which do not have index pages. It also explains the most common reason for "403 Forbidden" errors and the corresponding solution.
DETAILS:
Have you ever uploaded a directory of images or files not wanting to have to link to them from an index page, then found yourself getting the "Forbidden" error page when you try to look at them?
The answer lies in a small feature called .htaccess. With it, you can allow directory browsing for specific directories, among other things.
Making directories browsable:
- Create a text file in notepad or another plain text editor.
- Type this line (it is case sensitive):
Options +Indexes - Save this file with the name "temp.htaccess". Make sure to save the file as plain text in your program of choice.
- Upload this file to the directory on your server that you wish to make browsable and change the name of the file to .htaccess.
Now that you have a directory of your site with some files in it, and this .htaccess file with the line: "Options +Indexes" you should be able to browse to that directory and see a list of all the files (if any) that are in it.
If you have uploaded an index file but it is still not showing up please make sure it is named index.html or index.php, your webserver is case sensitive so Index is different from index and will not be used as a default page.
Revisions:
07-20-2009: Minor Fixes
12-17-2008: Updated text about creating the .htaccess file as this was causing confusion.
05-06-2008: Changed article to cover all servers - Thanks to Andrew Ellis for the feedback.
06-03-2008: Added "Make sure to save the file as plain..." Thanks to Ethan for the feedback.
Fields marked with an asterisk(*) are required. Comment on this article