You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Devraj Mukherjee <de...@gmail.com> on 2006/08/25 08:04:18 UTC

[users@httpd] Use of environment variables in configuration files?

Hello World,

Is it possible to environment variables such as the domain name being
access to adaptable Apache configuration.

Such as

Alias /documents /home/www/domain.com.au/documents

Where domain.com.au could be replaced depending on what domain name
was accessed.

Any help is appreciated.

Thanks.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Use of environment variables in configuration files?

Posted by Devraj Mukherjee <de...@gmail.com>.
Thanks for that Joshua.


On 8/25/06, Joshua Slive <jo...@slive.ca> wrote:
> On 8/25/06, Devraj Mukherjee <de...@gmail.com> wrote:
> > Hello World,
> >
> > Is it possible to environment variables such as the domain name being
> > access to adaptable Apache configuration.
> >
> > Such as
> >
> > Alias /documents /home/www/domain.com.au/documents
> >
> > Where domain.com.au could be replaced depending on what domain name
> > was accessed.
>
> Not in general, since most apache directives are resolved at
> start-time, not at request time.  But in that particular case, you can
> use mod_rewrite:
> RewriteEngine On
> RewriteRule ^/documents /home/www/%{SERVER_NAME}/documents
> (You probably want to assure that UseCanonicalName is set On in this
> case to avoid bad things happening when people supply arbitrary Host
> headers.)
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Use of environment variables in configuration files?

Posted by Joshua Slive <jo...@slive.ca>.
On 8/25/06, Devraj Mukherjee <de...@gmail.com> wrote:
> Hello World,
>
> Is it possible to environment variables such as the domain name being
> access to adaptable Apache configuration.
>
> Such as
>
> Alias /documents /home/www/domain.com.au/documents
>
> Where domain.com.au could be replaced depending on what domain name
> was accessed.

Not in general, since most apache directives are resolved at
start-time, not at request time.  But in that particular case, you can
use mod_rewrite:
RewriteEngine On
RewriteRule ^/documents /home/www/%{SERVER_NAME}/documents
(You probably want to assure that UseCanonicalName is set On in this
case to avoid bad things happening when people supply arbitrary Host
headers.)

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org