Click to See Complete Forum and Search --> : indexing files in a directory
Morph
03-19-2001, 08:25 AM
Hi,
I want to be able to go to a directory and if I dont have an index.html file then just a directory listing of the files in there to show - ya know, the normal, filename, cretaion date, size etc stuff in column format. SO how do I go about this?
I am running virtual servers so I one of my virtual servers to automatically look for the inddex.html file whilst the other just lists the files in a directory if index.html isnt there.
Cheers,
freebsd
03-19-2001, 10:50 AM
Upload or creat an .htaccess file in your docroot with the following:
-Indexes
no more, no less. You don't even need to create an index.html anywhere for that purpose at all.
>> then just a directory listing of the files in there to show
Because your server has enabled options Indexes globally. Putting -Indexes is to disable it for your site.
Morph
03-20-2001, 03:53 PM
Originally posted by freebsd:
Upload or creat an .htaccess file in your docroot with the following:
-Indexes
no more, no less. You don't even need to create an index.html anywhere for that purpose at all.
>> then just a directory listing of the files in there to show
Because your server has enabled options Indexes globally. Putting -Indexes is to disable it for your site.
HI again,
OK I did that but I am afraid it didnt work. If I understand you correctly I create a .htaccess file in the required directory where I want indexes to show and I put a single line in that file, '-Indexes' (without the quotes). That didnt work, so I tried it without the minus sign. Again the same result.
Also in one of my virtual servers directories I automatically get file listing in a sub directory if there is no index.html but the same does not work for the other virtual servers. The virtual server that it DOES work for is being run out of the original document root before virtual servers were set up. I hope I have explained this ok.
So.. for one virtual server automatic file listing works if there is no index.html but the same does not apply to my other virtual servers.
Any ideas folks?
Morph
03-20-2001, 04:03 PM
Oh I am running APACHE 1.3.17 and I have set the directory permissions as follows for the virtual server runnign from /home/virtual/domain:
drwxrwxrwx 2 nobody nobody 8192 Mar 20 21:52 domain
I have also tried chgrp to root and also chown to root too. All with the same result.
goozey
03-20-2001, 09:32 PM
what i do... is turn off indexing by default, then if i want it on for a particular directory... i just modify the httpd.conf file, restart the server, and all is fine.
<Location /directory/>
Options +Indexes
</Location>
Morph
03-21-2001, 09:51 AM
ok thanks guys I got it working.
Before my virtual server where I wanted file listing to show I just put:
<Directory /home/virtual/domain>
Options +Indexes
</Directory>
restarted APACHE and that seemed to do the trick.
Thanks for the help and ideas guys :)