[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: Virtual host with mod_perl
From:       Valerio <valerio.bontempi () gmail ! com>
Date:       2008-03-28 17:41:35
Message-ID: ad6681df0803281041s496f039cv68d3545a4bfc05be () mail ! gmail ! com
[Download RAW message or body]

Hi Torsten,

if my page contains relative paths (for example for images), I suppose
that I have to set document root and return DECLINED. It is correct?
It seems to work using this solution

thank you

Valerio



2008/3/28, Torsten Foertsch <torsten.foertsch@gmx.net>:
> On Fri 28 Mar 2008, Valerio wrote:
>  > I set both document_root and filename: can I set just only the
>  > filename or the document-root or I have to set both them?
>
>
> filename is just enough. You need to set docroot only if you have CGI scripts
>  or similar that use it. You can also set only docroot and return DECLINED.
>  The default trans handler then does the rest.
>
>  You may also want to cache your DB lookups at least for the duration of the
>  request. There are subrequests (when a directory index is created or mod_cgi
>  computes PATH_TRANSLATED or similar). Each one of those would repeat the DB
>  lookup otherwise.
>
>
>  sub handler {
>   my $r=shift;
>
>
>   my $vpath;
>   if( $r->prev ) {               # handle subrequests
>     $vpath=$r->prev->notes->{vpath};
>   } elsif( $r->main ) {          # handle internal redirects (ErrorDocument)
>     $vpath=$r->main->notes->{vpath};
>   } else {
>     $vpath=db_lookup(...);
>     $r->notes->{vpath}=$vpath;
>   }
>
>   $r->filename($vpath.$r->uri);
>   return Apache2::Const::OK;
>  }
>
>
>  Torsten
>
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic