perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Ghizaru" <adr...@rpromo.com>
Subject DirectoryIndex file in Embperl::Object, a quick solution
Date Tue, 20 Aug 2002 01:47:12 GMT
Hello list!

A few days back I came to you with a problem concerning Embperl::Object not using Apache's
DirectoryIndex directive. Gerald Richter unfortunately informed me it is indeed a known issue
and will be worked on.

Just for reference, in case people may need this here or there, here is a simple workaround:

In your template (base) file, use the following as your _first_ line:
[- if ($ENV{REQUEST_URI}=~/\/$/) { $http_headers_out{'Content-Type'} = 'text/html'; } -]

Then when you call your requested files, instead of Execute('*'), use
if ($ENV{REQUEST_URI}=~/\/$/) { Execute('index.html'); } else { Execute('*'); }

This will cause a request ending with a slash ( / ) to be served the file index.html (of course,
this is to be changed to your prefered index file).

Certainly, more sophisticated things can be conceived, such as multiple index files (index.html,
index.htm, index.pl, etc) or even reading the DirectoryIndex directive off Apache itself (is
this possible? guess so...), but I only need this for my personal website, so I did not bother
with anything fancy, this quick fix did my job. Hope it helps someone out there...

- Adrian.

Mime
View raw message