You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Richard Lewis <ri...@fastmail.co.uk> on 2004/11/18 12:49:38 UTC
[users@httpd] AliasMatch with env variable
Hi there,
Does Apache (1.3) allow me to use arbitrary environment variables in
arbitrary places?
e.g.
# set 'site_version' to the base directory for the user's browser
SetEnv site_version /var/www/default
BrowserMatchNoCase msie site_version=/var/www/explorer
# etc...
# and later on direct requests for CSS stylesheets
# to the correct location using 'site_version'
AliasMatch "^.*/([^/]*).css" $site_version/$1.css
So, when an HTML page includes:
<link rel="stylesheet" type="text/css" href="style.css" />
an error message in /var/log/apache/error.log appears like this:
[date] [error] [client ] File does not exist: $site_version/style.css
its not translating '$site_version' in AliasMatch to the value of the
variable.
Is it supposed to? And, if not, how can achieve this?
Cheers,
Richard
--
Richard Lewis
richardlewis@fastmail.co.uk
---------------------------------------------------------------------
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] AliasMatch with env variable
Posted by Joshua Slive <js...@gmail.com>.
On Thu, 18 Nov 2004 11:49:38 +0000, Richard Lewis
<ri...@fastmail.co.uk> wrote:
> Hi there,
>
> Does Apache (1.3) allow me to use arbitrary environment variables in
> arbitrary places?
No. httpd.conf is a configuration files, not a programming language.
> AliasMatch "^.*/([^/]*).css" $site_version/$1.css
Some choices:
1. Use mod_rewrite, which can look at environment variables (though
using a different syntax; check the docs).
2. There are at least a couple of third-party modules that do macro
substitution in 1.3 configs. I believe one of them is called
mod_macro. Check http://modules.apache.org/.
3. Use a config pre-processor like m4 to do substitution for you.
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