How to execute a script before returning a directory listing in Apache?

Viewed 87

With Apache how might one execute a server-side script (let's say a PHP script) when the URL is requested before returning the default directory listing (when +Indexes is enabled)?

I've tried the following Action and SetHandler directives as suggested here

<Location "/test">
  Action pre-script "/scripts/access.php"
  SetHandler pre-script
</Location>

This executes the script perfectly when I make a request but the response from the executed script is returned to the client. I really want the directory index to be returned instead.

Is there any way to achieve this or am I barking up the wrong tree?

0 Answers
Related