Forum Moderators: coopster & phranque

Message Too Old, No Replies

index.html calls a script...

How do I do this?

         

physics

9:29 am on Mar 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What is the quickest way to set up a system with perl such that when someone calls the index.html file a perl script is used to generate a page showing all files in that directory. Should I just use SSI? I know that there have been many posts like this but I can't find them right now.

Josk

9:53 am on Mar 11, 2002 (gmt 0)

10+ Year Member



which web server are you using?

I don't know about the ms but apache can be configured so that www.foo.com/domedir/ will show the contents of that directory...

physics

10:06 am on Mar 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Apache :)

gethan

10:20 am on Mar 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK Assuming Apache.

1) in httpd.conf or .htaccess on the directory in question.

Options Indexes

Don't have an index.html and apache does the listing for you.

2) in httpd.conf or .htaccess on the directory in question.

AddHandler cgi-script cgi
Options ExecCGI
DirectoryIndex index.cgi index.html

Will first look for index.cgi then look for index.html

Make index.cgi a little app that lists the directory and formats in your brand etc.

3) ... erm ... there are several other options but unless for very specific applications the two above will be good enough.

Gethan

token

6:14 pm on Mar 11, 2002 (gmt 0)

10+ Year Member



here's a file manager/upload script with options to listview any directory in your server space, including the root if you have access, and to list kilobyte size of all directories:
[xav.com...]

physics

11:14 pm on Mar 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks! Now what if I want to be tricky and have:

[foo.com...]
somehow a program is run that goes through the dir, but
[foo.com...]
is returned
Would the easiest way be just to use SSI in an index.html file? I just want to have dynamic directory listings and fool the spiders at the same time :)

gethan

9:36 am on Mar 12, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yep an SSI call is one way to go... not very experienced with SSI but I don't think there is a directory listing call so you would have to write a cgi to do this or a system call could be used (not pretty):

<pre>
<!--#exec command="ls -l"-->
</pre>

Or assuming ls.cgi does a pretty listing

<!--#exec cgi="ls.cgi"-->

You also need in .htaccess

Options Includes
AddHandler server-parsed .html

HTH