how to restrict directory listing in apache

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

how to restrict directory listing in apache

Post by raghavan20 »

If an index.html or index.php file is not in an htdocs directory, I want to restrict the user from viewing the files in the directory. Any tutorials or scripts on that?

I am new to apache configuration process, I would be happy if someone can point to a tutorial which starts with basics and covers most of the topics with examples.

Thanks
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

I have not read about this option and it says that this line has to be added in .htaccess file. I do not have a .htaccess file in my apache directory and its sub-directories. Is .htaccess different from httpd.conf file, if so, then where should I put the new .htacess file.

Please bear with my ignorance in the issue.
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

I have put the same line in httpd, it displays the following thus blocking access

Code: Select all

Index of /temp

Icon  Name                    Last modified      Size  Description

Apache/2.0.55 (Win32) PHP/5.1.2 Server at 82.x.x.x Port 8080
How can I make the Apache to display, 'Access is forbidden' in a separate page because I have seen this possible elsewhere?
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

Disable mod_autoindex
Post Reply