I'm setting an environment variable in an htaccess file and it's being prepended with "REDIRECT_". As far as I've read, this is caused by URL rewriting.. the thing is, I'm not doing any rewriting (that I'm aware of).
My webspace contains two files:
.htaccess
SetEnv Foo "bar"
index.php
<?php
print_r($_ENV);
Now, I'm guessing this may have something to do with the fact that this is on a shared hosting package with 1&1.. is there anything else I should be checking or has anyone experienced this before? Or am I just missing something??
Cheers
The issue is triggered by using PHP as a CGI Wrapper. If PHP is running as mod_php apache module it's not prefixing your variables.
Reason for that is internal redirect handling thus apache recreates the variables with the REDIRECT_ prefix :-/
Use PHP-FPM or mod_php
If you wanna use CGI Wrapping for PHP put this into your .htaccess:
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With