[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Apache question





I'm not sure, but I think one way to accomplish this is with the
DirectoryIndex  command.  This is the command that tells apache that
"inxex.html" is the document that it should return by default.  In fact
though, you can use this command to look for several things before retruning
a listing of the directory.  For eaxmple

DirectoryIndex index.html index.htm index.shtml

Will look for index.html, then index.htm, and finally index.shtml before
giving up and listing the contents of the directory.  But, according to the
Apache documentation, you do not have to give it a relative pathname to the
file.  What this means is that you can put a static path to an html file, or
even CGI that generates html, and if it cannot find "index.html" let it
return that set file instead.

See:

http://httpd.apache.org/docs/mod/mod_dir.html#directoryindex

For example, say you had a CGI program that generated an HTML document
called search.pl in /cgi-bin/search.pl.  Pretend further that you expect a
file called "index.html" to be in your user's directory, but if it's not
there, it will run your CGI instead.  Or instead of the CGI, replace it with
an html file.  The syntax looks like:  

DirectoryIndex index.html index.txt /cgi-bin/search.pl 

Likewise, if you had a file called /default.html that you wanted to return
you could say:

DirectoryIndex index.html default.html

Does that make sense (other than the directory where we are placing the CGI,
which probably isn't a good place) ?


Randy

-----Original Message-----
From: Brune, Charlie [mailto:Charlie.Brune@anheuser-busch.com]
Sent: Monday, December 18, 2000 1:29 PM
To: silug-discuss@silug.org
Subject: Apache question


I am trying to use the Apache web server.

Problem:  If you try looking at my site and give it a directory name (i.e.,
not
the .html file within the directory), it gives you a listing of the files in
the
directory.  I would prefer not to show folks the files within the directory.
(Hope that made sense!)

Worse yet, it allows you to navigate to other directories.  (Although you
can
only browse directories and files within /var/httpd).

Is there a way to tell Apache not to provide these directory listings?  I
tried
looking through /etc/httpd/conf/httpd.conf, but couldn't figure out how to
turn
this feature off.

Thanks once again!
Charlie  8-)


-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.
-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.