Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a script that I want to run on every subdomain request like, larry.mysite.com, mustard.mysite.com but not www.mysite.com.

The script needs to know that the subdomain it was called from was "larry", or "mustard".

Can someone point me in the right direction on how to do this? I think it'll involve mod_perl 2 ( I'm using Apache 2 ) but I'm not sure what to even start looking for.
  • Comment on Get Subdomain w\Apache & maybe MOD_PERL?

Replies are listed 'Best First'.
Re: Get Subdomain w\Apache & maybe MOD_PERL?
by ww (Archbishop) on Jun 23, 2009 at 09:51 UTC
    This reply may reflect the writer's seriously under-cafeinated condition, but, IMO, you'll likely do well by:
    1. familiarizing yourself with just how subdomains work (cf: "virtual host").
      See http://httpd.apache.org/docs/2.0/vhosts/examples.html.
      and
      such terms as "mod_proxy" or "AliasMatch"
      and/or
    2. clarifying your question;
      • ascertaining whether this is actually a Perl-related issue;
      • specifying the circumstances in which you expect (I gather) to call a script in root's cgi-bin from <edit> one or more</edit> subdomains.