Please wait while we load your page...



Article [Disable Directory Browsing]

Results 1 to of

Disable Directory Browsing

Here are the lines to add to your .htaccess file to disable directory browsing (client's browser displays a Web page that lists the contents of a directory when a request does not specify a document name, and no index.html file exists in that directory):

# Disable directory browsing
Options -Indexes
# Set the default handler
DirectoryIndex index.php

The first line disables directory browsing. The DirectoryIndex directive sets the list of resources to look for, when the client requests an index of the directory by specifying a / at the end of the directory name. In this case, if no specific file requested, the server serves index.php. This overrides server default of index.html. You can specify any file / file type. In most cases, the Options directive is not necessary since, by default, Apache (web server) is configured as "Options -Indexes".

Last Revised: 2015-08-30

Live Chat Not Available