Home
 

Customer Support

Search for keywords:

Browse by category:

How do I stop people from getting directory listings
when I dont have an index page?

If a URL which maps to a directory is requested, and the there is no DirectoryIndex (e.g., index.html) in that directory, then the server by default will return a formatted listing of the contents of that directory.

To turn these directory listings off, simply add to (or create) an .htaccess file in the directory you want to protect and insert:
Options -Indexes

If you are just trying to change what the default index page will be called, see this other FAQ.

User-Contributed Notes

add a note
29-Mar-2004 10:38
All you do is create a file named: .htaccess

Inside that file you put 1 line:

    Options -Indexes


You upload the file to your home directory with your FTP program and
then no more directory listings will get shown.

info -at- dryfoo.com
07-Sep-2007 16:00
You could always just create a "dummy" index.html file with no content:

<html><head>
<title>No Access Allowed</title> </head><body>
No Access Allowed
</body></html>


anonymous -at- example.com
01-Jul-2008 13:56
Just adding a .htaccess file may not always work.  The apache
configuration settings have to be such that AllowOverride is set to
include the 'Indexes' option.  Normally, the default configuration is to
"AllowOverride All" which should allow the .htaccess file to change
directory listing options.  If the .htaccess file does not work for you,
you can either modify your apache configuration to allow it, or ask your
admin to change it for you.

The index.html file is a good and easy way to get around this.  If your
system supports php and index.php files, you can make a simple php
index.php as:

<?php
  header("Location: http://www.example.com";);
  exit;
?>

  This will always redirect someone who is trying to get a listing of
the directory contents.  This is my preferred method.

add a note

Related Questions:


Why does my website just say "Error 403 Forbidden"?

How do I protect a directory with .htaccess?

How can I show a default page other than index.html?

What do the different HTTP Status Codes like 200, 304, 404, 401, 403 mean?

What options are configured with Apache and what can I do with .htaccess files?

How do I protect a directory with mod_auth_mysql?

How do I stop other websites from using my bandwidth while they steal images, flash, etc. from my site?

Which Apache modules are installed?

How do I make my own Error Documents to replace the default ones like 404 Not Found?

How can I make apache recognize different MIME types?

The webservers' Gzip compression is messing up my XML or Flash files for Netscape 4 browsers. How do I turn off compression?

How do I get different character sets to display correctly?

What webserver do you run?

Will I have access to raw logfiles?

I created a symbolic link, and now I am getting a 404 errors.

How do I stop the server from automatically correcting spelling mistakes in URLs or offering multiple choices for documents?

My mod_rewrite rules make my website stop loading.

Why am I getting a 412 Precondition Failed from a website?

How do I protect my website from comment spam?

How do I enforce the use of SSL on my website?

How do I redirect traffic to another web page?

Browse Categories:

Getting Started, FTP, Telnet/SSH, Moving Domains, E-mail, Traffic Reports, Mailing Lists, Apache, PHP, CGI, Other Server-Side Scripting, MySQL Database, Imaging Libraries, Other Software, Billing & Terms, Control Panel, E-commerce, Pre-Sales


Tiny Modwest Logo         Copyright 2000-2008 by Modwest, Inc.          About Us    |    Blog    |    Jobs    |    Web Design    |    Contact Us