How do I fix a "Directory Listing Denied" or "Forbidden" error?
The error message you see refers to the fact that you currently do not have a default document (index.html or other default index file) uploaded to your website. The default behavior is to block access to directories without the default index file for security and privacy reasons. A default document is a page that is loaded automatically when someone attempts to view your website. To fix this error message you can use an FTP program to upload a default document. The most common default documents are:
If you need a different home page name (called a "default document"), you can adjust this through your Control Panel. In most cases it is easier to rename your home page to one of the documents above. Please note that some file names (such as .asp and .shtml) are reserved for specific types of web applications. If you are unsure of which file extension to use, you can probably safely use .htm or .html. Also, these documents carry an "order of precedence" as they are listed above. For example, if you have both an index.html file and a default.html file, the index.html file will be the one that shows up when viewing your site with the domain name or IP address.
If you have a need to change the default behavior of blocking the directory listing, this can be accomplished either on a site-wide basis or on a directory-by-directory need. To allow a web server to produce a directory listing, whenever you point a directory without index file. Add following line in your .htaccess file.
The result of this .htaccess file will look like this:
Let's say you want to disable the user.php files from showing in your directory listing, you would need to add the following option:
Now, let's say you want to use IndexIgnore to block directory listing completely, you would need to instead use:
To disable or prevent the directory access add following line in your .htaccess file.
Following is the error page that gets displayed when we try to access any directory without index file.
You may want to display other details while showing the directory listing. This includes file icons, file size, modification date and more. This can be done by adding fancy style to your .htaccess file. Add following snippet in .htaccess file.
If you still cannot view your site please contact firstname.lastname@example.org for assistance.