ScriptAliasMatch vs. DirectoryIndex problem

Hello there,

I run a site on Apache 2 where I use my own simple templating system
which uses a script to dynamically modify all ".htm" page requests and
leaves everything else as-is.

I have the following in my configuration:

ScriptAliasMatch ^(.*html)$ /home/fuxoft/fuxoft.cz/fftempl/fftempl.cgi?
page=$1

Whenever anyone looks for "mysite.cz/subdir/page.htm", this request
gets passed to my script, which takes the page.htm file from the disk,
modifies it and returns the resulting full HTML to the visitor.

This works great.

I also have "DirectoryIndex index.htm" in my config, so that access
e.g. to "mysite.cz/subdir/" correctly displays "subdir/index.htm" file
(modified by my templating script).

However, problem arises with directories which contain only static
files (images, for example) and I want Apache to display standard
directory listing for them. The problem is that when someone wants to
view "mysite.cz/pictures/", this request is passed to my templating
script even when there is no "index.htm" file inside this directory. I
don't want this and I want the directory listing to be displayed when
there is no index file in the directory...

Can I do that? If not, can I at least turn off ScriptAliasMatch for
several specific directories?
fuxoft [ Mi, 07 November 2007 11:25 ] [ ID #1864774 ]

Re: ScriptAliasMatch vs. DirectoryIndex problem

On Nov 7, 11:25 am, Franti=9Aek Fuka <fux... [at] gmail.com> wrote:

> ScriptAliasMatch ^(.*html)$ /home/fuxoft/fuxoft.cz/fftempl/fftempl.cgi?pa=
ge=3D$1

Oops, I wrote that wrong. That's "htm", not "html", of course.
fuxoft [ Mi, 07 November 2007 11:28 ] [ ID #1864775 ]

Re: ScriptAliasMatch vs. DirectoryIndex problem

"FrantiĊĦek Fuka" <fuxoft [at] gmail.com> wrote in message
news:1194431150.695593.128530 [at] k79g2000hse.googlegroups.com.. .
> ...
> Can I do that? If not, can I at least turn off ScriptAliasMatch for
> several specific directories?

No. Maybe what you want is a rewrite rule....
(One would have a condition that the requested URL not end with a slash.)

There may be a more advanced way (using rewriting) to check and see if the
target file exists first.
spam [ Mi, 07 November 2007 11:38 ] [ ID #1864776 ]
Webserver » alt.apache.configuration » ScriptAliasMatch vs. DirectoryIndex problem

Vorheriges Thema: Many ..reading.. Request in server-status
Nächstes Thema: .htaccess rules help