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

How do I get my website use index.pl as the root file? What all do I need to consider if I want to make my website completely in perl if I am unable to use index.pl as a root file (workarounds?) im using imagelinkusa.com as a webhost if that helps

Replies are listed 'Best First'.
Re: Using index.pl as the default page
by Zaxo (Archbishop) on Jul 07, 2001 at 04:01 UTC

    In your directory's .htaccess file, say:

    DirectoryIndex index.pl #May also need: #AddHandler cgi-script pl

    The DirectoryIndex script need not be in the same directory. Give it a path to the script and it will run.

    After Compline,
    Zaxo

Re: Using index.pl as the default page
by DrZaius (Monk) on Jul 07, 2001 at 02:28 UTC
    You probably don't want to do it this way. If you are using apache, you'll want to look into mod_perl. It allows you to use handlers instead of scripts (which are generally faster) to accomplish this.

    Also, look at Apache::PageKit which is a complete templating system that allows you to write reusable components.

    You've just stepped into a design pattern that a large portion of perlmonks is familiar with. I'm sure if you ask a few questions and do some reading you'll find a superior, thought out plan to your website.

    Btw, if you are using apache, try:

    DirectoryIndex /index.pl
Re: Using index.pl as the default page
by dimmesdale (Friar) on Jul 07, 2001 at 02:27 UTC
    Well, one workaround would be to make an index.html that has a meta-tag to redirect to index.pl. However, that is not the most desirable solution. You should contact your web-host and see if they will modify the server for you, so that if it does not find an index.html it will load an index.pl for you. However, the method to do this varies depending on your web-server, so your best bet, as I said, is to contact whoever's hosting it for you.
Re: Using index.pl as the default page
by da (Friar) on Jul 07, 2001 at 06:35 UTC
    In the interests of exploring all options, nobody has mentioned renaming your index.pl to index.cgi, which is the standard extension for cgi scripts.

    ___
    -DA

Re: Using index.pl as the default page
by voyager (Friar) on Jul 07, 2001 at 03:10 UTC
    Depending on your Apache config, and/or how much control you have over it ... if a directory is set up to execute all files as cgi scripts but only treats index.html as index files, then just name your perl file index.html and it will still execute as Perl.
      nope didn't work.... I have to wait for them to install mod_perl :\
Re: Using index.pl as the default page
by thatguy (Parson) on Jul 07, 2001 at 20:47 UTC
    To use an index.pl on apache you have to add index.pl to DirectoryIndex, add .pl to AddHandler (should have .cgi there now) and allow ExecCGI in the Options for the directory that the index.pl resides.

    All this is gonna be moot if you don't have permission to change apache's conf file or your webhost won't do it.