On 4/29/10 12:54 AM, Nick Kew wrote:

On 29 Apr 2010, at 04:56, Mark Harrison wrote:

I would like to do a simple mapper:

   - given some inputs, calculate a file path
   - let apache serve out that file for me

Is there a simple example of how to do this?  mod_rewrite
is pretty heavy-duty, and I'd like to get a simpler
model to follow.

Maybe mod_rewrite will do all you need anyway!

It would, but I need to execute some internal logic to
fully resolve.

The simplest example to look at in the apache code would be
mod_alias.  Otherwise, the end of Chapter 6 of the modules
book[1] leads you through developing a mapper module.

Ah, the miracle of ebooks!  Yes, Chapter 6 seems to be just
what I need.

So, I think that I would:

- register a hook handler
- in the hook handler:
  - set an X-header
  - calculate a new file path
  - set r->filename to my file path
  - call ap_internal_redirect(const char *new_uri, request_rec *r)

Is that the right track to be going down?  This file path will be
on an external (NFS) storage device and not under the apache directory,
will that matter?

Thanks!
Mark

Reply via email to