![]() |
![]() |
![]() |
You Are Here: Home : cape.computing : Developers' Info |
|||
|
|
Preventing Directory Listings with htaccess
When a URL specifying only a directory is requested, for example http://www.somedomain.com/directoryname/, the web server looks for the following file names , index.html, index.htm, home.html, or, home.htm. If it finds a file by this name, it will serve the file, otherwise it will display a directory listing showing all the files in the directory. This behavior can be changed with the .htaccess "IndexIgnore" directive. To prevent files from being listed, create a .htaccess file with the following directive within the directory that you want to protect: IndexIgnore * The * symbol is a "wild-card" that matches all files. Specific files can also be ignored. For example, to ignore files with .jpg extension (*.jpg), create a .htaccess file with the following directive: IndexIgnore *.jpg The .htaccess file affects the directory in which it is placed, and, directories recursively below it.
The information presented in this section is deemed accurate but is
not guaranteed. It is provided as a free service to our subscribers
and clients. Additionally, Cape.Com, Inc. exercises no editorial control
over any links that are outside the www.cape.com domain and the content
of these sites does not necessarily represent the views and opinions
of our Company, its employees or clients.
|
|
|
||