: Question about .htaccess file for web site...


dieselcruiserhead
04-29-2003, 09:29 AM
I know some of you are fairly knowledgable when it comes to computers and web sites. I have a new site that has mysteriously lost it's .htaccess file that does not allow a viewer to see the contents of a directory without directly accessing the file. AKA if I link to a directory and want someone to see all the files in it, I have to list all of the directory's contents otherwise it will read "you do not have permission to view these contents."

I email the company's support and they wrote back:

Did you delete your .htaccess file? (which I did not).
You need to add a certain line to your .htaccess file (the last line below). So I created the file as a .htaccess file (not .htaccess.txt or something of the sort) and it would not allow me to have my site function properly, the entire site. In the end, I deleted all content and left the .htaccess file blank so the site is still viewable...

Here is the code, does anyone have any ideas what to do here...

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.websitename.com I realize this must be changed to accomidate the proper website address
AuthUserFile /home/virtual/site41/fst/var/www/html/_vti_pvt/service.pwd
AuthGroupFile /home/virtual/site41/fst/var/www/html/_vti_pvt/service.grp
DirectoryIndex index.html index.htm index.shtml default.htm default.html
Default.htm Default.html index.cfm
Options +Indexes

_____________
Just create it in notepad, upload it to the mainwebsite_html dir and make sure it is .htaccess not .htaccess.txt

Pavemen
04-29-2003, 10:26 AM
If you are going to use the DirectoryIndex term, just be sure to have at least one of the listed files uploaded to the site, even if empty. If you dont want to have that file there, assign some funny file name and use ErrorDocument clause to output 404 notice.

I use

DirectoryIndex index.php /error.php?403
ErrorDocument 404 /error.php?404

so that if index.php is not available, it will go to my custom error page outputting FORBIDDEN (or use 401 for PERMISSION DENIED). Any other attempt at viewing missing files goes to my error document. (I also list several other 40x and 50x errorsdocument terms).

dieselcruiserhead
04-29-2003, 11:15 AM
I understand that but that's NOT what I want to happen.

For example, check out this directory:
http://www.uvm.edu/~ashoumat/fj55/

It lists the contents of the directory without there being any default page.

This directory (on the site in question), will not allow the same contents to be viewed because of the .htaccess file, correct?
http://www.collegeinternetsolutions.com/cisautoweb/dtlc/mustard/

Think you could whip up a version of the above text that I could cut and paste so that the contents of directory can be viewed without a web page? I don't want to have to go through and create a page for each directory I have images in. I want to be able to say "take a look at these picts" that have been dumped into one folder without building something for them to be viewed...

Pavemen
04-29-2003, 02:07 PM
Sorry... I thought you wanted to block the file listing, not allow it.

It looks like the server level confiruation is not allowing directory listing, so your htaccess needs to overwrite that rule.

According to http://httpd.apache.org/docs/mod/mod_dir.html#directoryindex having a DirectoryIndex term with a missing resource, a drectoy listing is generated. So use:

DirectoryIndex garbage.in

and you should see the file list. I have not tested it but according to the Apache doc, that should work.

Also, the .htaccess file needs tobe in the directory you want to allow listing as .htaccess directives are propegated to child folders.