jordan at viviotech
Oct 20, 2011, 4:39 PM
Post #2 of 2
Well, as what usually happens when you post to a mailing list and
Re: Getting DocRoot of currently requested VirtualHost
[In reply to]
publicly ask for help, I figured it out. I am humiliated to admit that
my problem was an apache configuration, so the DocRoot for the
VirtualHost was resolving to the first VirtualHost's DocRoot instead of
the proper VirtualHost's DocRoot. ::sigh::
my $document_root = $r->document_root();
returns the proper docroot for the virtualhost as long as your apache
settings are correct! A day wasted on something completely stupid!
Huge thanks to the folks that offered to help. Your support is deeply
On 10/20/2011 03:04 PM, Jordan Michaels wrote:
> Hey Folks,
> I'm pretty new to mod_perl but not new to programming in general. I'm
> working on a mod_perl Apache module and I'm trying to find the way to
> get the Document Root of the Currently requested VirtualHost.
> I can get the currently requested domain name easily enough with:
> my $servername = $r->get_server_name();
> But getting the document root for that domain is proving to be a
> challenge with VirtualHosts.
> running this code:
> my $document_root = $r->document_root();
> Returns the first VirtualHost's document root, and not the document root
> of the domain that's being requested.
> I'm pretty sure I'm just missing something noobish here, but any
> pointers on how to go about getting the document root of the current
> requested VirtualHost would be *deeply* appreciated.
> Thank you in advance!