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
| [reply] [d/l] |
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
| [reply] [d/l] |
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. | [reply] |
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 | [reply] [d/l] [select] |
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. | [reply] |
nope didn't work.... I have to wait for them to install mod_perl :\
| [reply] |
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. | [reply] |