What causes Apache Environment Variable set using mod_rewrite to have "redirect_" appended to name?

Posted by trowel on Stack Overflow See other posts from Stack Overflow or by trowel
Published on 2010-06-16T02:58:29Z Indexed on 2010/06/16 3:02 UTC
Read the original article Hit count: 190

I am trying to set Apache environment variables (for use in PHP) with the [E=VAR:VAL] flag on RewriteRule rules in an .htaccess file.

I have already discovered the variables are accessed in PHP as server variables $_SERVER rather than $_ENV (which makes a certain amount of sense). However, my problem is for some rules the [E=VAR:VAL] flag works as expected and I end up with a variable $_SERVER['VAR'] but for other rules I end with a variable $_SERVER['REDIRECT_VAR'] or $_SERVER['REDIRECT_REDIRECT_VAR'], etc

A. What causes an Environment Variable set in Apache using the [E=VAR:VAL] flag to get renamed by having "REDIRECT_" appended to the front of the variable name?

B. What can I do to make sure I end up with an Environment Variable with an unchanged name so I can access it in PHP as $SERVER['VAR'] without having to resort to checking for variations of the variable name having one of more instances of "REDIRECT" appended to the front of it?

© Stack Overflow or respective owner

Related posts about php

Related posts about apache