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:

index.html,  index.htm,  index.shtml, index.asp,  default.html,  default.htm,  default.shtml,  default.asp

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.

Options +Indexes

The result of this .htaccess file will look like this:

allow-directory-listing-htaccess

 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:

IndexIgnore user.php

 Now, let's say you want to use IndexIgnore to block directory listing completely, you would need to instead use:

IndexIgnore *

 To disable or prevent the directory access add following line in your .htaccess file.

Options -Indexes

 Following is the error page that gets displayed when we try to access any directory without index file.

403-directory-listing-error-htaccess

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.

IndexOptions +FancyIndexing

fancy-directory-listing-htaccess

If you still cannot view your site please contact support@osiriscomm.com for assistance.

(88 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments: