Apache_1.3.26 - Directory Access
| From: | janet at valade dot com | Date: | Fri, 31 Jan 2003 19:55:28 +0000 |
| Subject: | Apache_1.3.26 - Directory Access | ||
| Groups: | php.install | ||
| Request: | Send a blank email to php-install+get-9911@lists.php.net to get a copy of this message | ||
In a message dated 1/31/2003 10:09:48 AM Pacific Standard Time,
Atif_Jakupovic@hc-sc.gc.ca writes:
>For example: The
>'http://my_web_site/my_directory/index.php' file will be
>displayed correctly, but if I type
>'http://my_web_site/my_directory/' I'll
>see the list of files and directories in the 'my_directory' directory.
>
> (Embedded image moved to file: pic30568.pcx)
>
>This is not secure.
>
>Please, does somebody know how I can protect a direct access to my
>directories from a web browser?
You have two issues here. One is that you do not have the default file set to
index.php. That is, when the URL specifies a directory, the server looks for
a specified file to send by default, and, in your setup, index.php is not one
of the files it looks for to send by default. This is a setting in your web
server. You need to change the setting there. In Apache, you specify this as
follows:
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>
Your second issue is that the web server displays all the files in the
directory when you don't have the default file it's looking for. This is also
a setting in the Web server. In Apache, you specify this as follows:
Options Indexes (to turn it on)
Options -Indexes (to turn it off)
You want to change the setting. Then, the web server will send a message when
the file is not present in the directory, e.g.:
Forbidden
You don't have permission etc.
Janet
--------------------
Janet Valade
Author, PHP & MySQL for Dummies