I have this little .htaccess file:
RewriteEngine on
RewriteRule ^(.*)$ urlroute.php?q=$1 [E=myvariable:'withthisvalue',B,QSA]
To direct all requests to my URL routing script. It works great and I can access the requested URL in urlroute.php as $_GET['q']
.
I'm setting the environment variable myvariable
using mod_rewrite
I am able to access it in urlroute.php as $_SERVER['myvariable']
. I am not able to access it using $_ENV['myvariable']
which seems strange. Could someone please explain what the reason could be?
To my knowledge, mod_redirect will prepend REDIRECT_
to environment variable names when doing a redirect (which it always does in my case). But for me both $_SERVER['myvariable']
and $_SERVER['REDIRECT_myvariable']
are available and set to the same content. Why?