You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Nilo César Teixeira <ni...@gmail.com> on 2008/03/04 21:02:06 UTC

[users@httpd] Referencing Environment Variable in httpd.conf

Hi all,

This is my first post so I would like to share what made me get here.

I´m evaluating Drupal as a CMS, and since I´m running Vista Ultimate the
natural choice was to get Drupal working over IIS7.

Drupal has a neat featured called "Clean URLs" which requires URL Rewriting,
so that a path like
/drupal?q=admin/build/block
can be re-written as
/drupal/admin/build/block

Unfortunately, IIS >doesn´t currently have< any URL Rewriting, free ISAPI
filters that work. Tried ISAPI_Rewrite Lite and Ionic ISAPI Rewrite all day
yesterday and it only led me to frustation...

So after realizing I needed to get Apache to get the work done, I installed
it and started configuring httpd.conf.

NOW TO THE POINT: I read an old post on this newsgroup mentioning you could
access Enviroment Variables in httpd.conf

Since I already had defined variables (APACHE_HOME for Apache´s root
directory and PHPRC for PHP installation dir), I WOULD LIKE TO SAY:

IT IS POSSIBLE TO REFERENCE A SYSTEM ENVIRONMENT VARIABLE IN HTTPD.CONF,
STATE IT LIKE:

${MY_SYS_ENV}

(First I tried %{MY_SYS_ENV} but I forgot that env variables are just
scalars and thus follow the perl-like syntax - a simple dollar sign prefix)

In my case, I had:

#Clean URL for Drupal
<Directory "${APACHE_HOME}/drupal">
   RewriteEngine on
   RewriteBase /drupal
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>

I found this valuable info in this archive:
http://www.issociate.de/board/goto/1147159/Using_environment_variable_in_httpd.conf.html

so after that I have clean urls working, THANKS FOR THAT !

Niloct