Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

How to make the default?

by kiat (Vicar)
on Apr 22, 2003 at 23:31 UTC ( #252399=perlquestion: print w/replies, xml ) Need Help??

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

Hey monks,

I'm curious how on this site the file is parsed by the server as the default file. Most servers treat index.html or index.htm as the default file. How does one make or index.cgi the default file like index.html? I would to have, say,, automatically loads up when the site is accessed. How does one do that? Is it a server side thing that can only be done by the server hosting company?

Thanks in anticipation.

Replies are listed 'Best First'.
Re: How to make the default?
by jasonk (Parson) on Apr 22, 2003 at 23:38 UTC

    Most web servers can be configured to treat any filename you want as the default, for Apache this is done with the DirectoryIndex directive, for other servers there should be a similar setting.

    We're not surrounded, we're in a target-rich environment!
Re: How to make the default?
by TVSET (Chaplain) on Apr 22, 2003 at 23:39 UTC
    That's easy :)

    You have to configure your server to use or index.cgi (or whatever you want) as a default Index page. If you are using Apache web server, then you have to use DirectoryIndex directive. Here is a an example from my config (/etc/httpd/conf/httpd.conf):

    # # DirectoryIndex: Name of the file or files to use as a pre-written HT +ML # directory index. Separate multiple entries with spaces. # <IfModule mod_dir.c> DirectoryIndex index.epl index.html index.htm ndex.shtml index.php + index.php4 index.php3 index.phtml index.cgi index.epl index +.mhtml index.mpl </IfModule>

    It is possible in any(?) other server too. I've seen it even in MS IIS, but don't remember where. :)

    Leonid Mamtchenkov

      If you are using Apache then this can also be placed in a file called .htaccess in your website directory, so you don't need to configure the server itself. Seach google for 'htaccess'.

Re: How to make the default?
by The Mad Hatter (Priest) on Apr 22, 2003 at 23:44 UTC
    It is an option to turn on in Apache's httpd.conf. Check out the option DirectoryIndex in Apache's documentation.
Re: How to make the default?
by Abigail-II (Bishop) on Apr 22, 2003 at 23:46 UTC
    That isn't really a Perl question, is it? I suggest asking in the Python community how to make the default, and then replace py with pl in their answer.

    Or you could just read the manual page of your server, because it's a server issue, and it depends on the server whether this is possible, and if, how. The language in which the program is written it totally irrelevant.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://252399]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2019-10-22 11:50 GMT
Find Nodes?
    Voting Booth?