> The 'staged' version of their site is stored in a different directory,
> and if i could just changed the document_root dynamically, most(?) of
> our issues would be over.
>
> Is there a way to do this? The documentation does not have any reference
> to be able to change the document root (just get it via
> $r->document_root).

You might want to use a translation handler (Chapter 7 of the Eagle book.)

We did something similar to this, where if a browser asks for an index page
it forces apache to use a db file to get its filename/path.  You could check
the incoming path for the "Preview" mode and set $r->filename.

Something like:

my $uri=$r->parsed_uri;
my $Path=$uri->path;

if ($Path =~ /Preview/)
{
    $r->filename($Path_to_file_on_filesystem);
    return OK;
}

return DECLINED;

The above might not exactly do it, but its just a rough example.  The return
OK will make apache skip its own URL to file translation stuff, where return
DECLINED should let apache continue as normal (reading httpd.conf for
finding paths, etc.)

Marc Slagle




Reply via email to