LukeyBoy has asked for the wisdom of the Perl Monks concerning the following question:

I have a website that's currently built up in Perl scripts with no actual HTML pages. My goal is to have the domain name (http://gateway/ for instance) map to a specific CGI script. I tried adding:

Redirect /index.html "http://gateway/cgi-bin/nph-login.cgi"

But obviously, this is a redirect and that's not what I want (for weird reasons - basically the login script can send a redirect and two redirects in a row mess up the browsers being used in certain circumstances).

Is there any way to make an index.cgi (or rather nph-index.cgi) in the root of the Apache documents folder be automatically executed when someone hits the site? Thanks!

Replies are listed 'Best First'.
Re: Getting Apache to execute a CGI for the index page
by merlyn (Sage) on Feb 06, 2002 at 20:45 UTC
Re: Getting Apache to execute a CGI for the index page
by grep (Monsignor) on Feb 06, 2002 at 20:45 UTC
    It's the 'DirectoryIndex' directive in your httpd.conf.

    DirectoryIndex index.cgi

    FYI: This can be set at the server level, virtual server level or directory level.

    BTW not really a perl question is it?

    grep> chown linux:users /world
      Yeah, my bad. I guess it's more of an Apache question - though other Perl people might ask the same question in the future. Thanks guys, and sorry for not RTFM!

        HEY! I'm doing the same thing. I use a redirect as well and it works and I just thought "Eh, that works".

        Granted I don't think I can get my ISP to make this addition for me without charging me so I am still in the same boat there for now. But at least on my home Apache server I can make the change.

        BTW: Just a quick thought...if you need to change the home page with this new method, you will need to shutdown and restart the server. Leaving it as a redirect means only updating the redirect file call. Something to think about if your into remote administration.

        Sean Shrum