ScriptAliasMatch vs. DirectoryIndex problem

ScriptAliasMatch vs. DirectoryIndex problem

am 07.11.2007 11:25:50 von fuxoft

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?

Re: ScriptAliasMatch vs. DirectoryIndex problem

am 07.11.2007 11:28:50 von fuxoft

On Nov 7, 11:25 am, Franti=9Aek Fuka 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.

Re: ScriptAliasMatch vs. DirectoryIndex problem

am 07.11.2007 11:38:57 von spam

"František Fuka" wrote in message
news:1194431150.695593.128530@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.