Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I haven't tested this at all and I know it doesn't address points A or B, but there is some description of this issue in the comments in PHP documentation and some possible solutions for accessing these variables using <code>$_SERVER['VAR']</code>:</p> <p><a href="http://www.php.net/manual/en/reserved.variables.php#79811" rel="noreferrer">http://www.php.net/manual/en/reserved.variables.php#79811</a></p> <p><strong>EDIT</strong> - some more responses to the question offered:</p> <p><strong>A:</strong> The environment variables are renamed by Apache if they are involved in a redirect. For example, if you have the following rule:</p> <pre><code>RewriteRule ^index.php - [E=VAR1:'hello',E=VAR2:'world'] </code></pre> <p>Then you may access VAR1 and VAR2 using <code>$_SERVER['VAR1']</code> and <code>$_SERVER['VAR2']</code>. However, if you redirect the page like so:</p> <pre><code>RewriteRule ^index.php index2.php [E=VAR1:'hello',E=VAR2:'world'] </code></pre> <p>Then you must use <code>$_SERVER['REDIRECT_VAR1']</code>, etc.</p> <p><strong>B:</strong> The best way to overcome this issue is to process the variables that you're interested in using PHP. Create a function that runs through the <code>$_SERVER</code> array and finds the items that you need. You might even use a function like this:</p> <pre><code>function myGetEnv($key) { $prefix = "REDIRECT_"; if(array_key_exists($key, $_SERVER)) return $_SERVER[$key]; foreach($_SERVER as $k=&gt;$v) { if(substr($k, 0, strlen($prefix)) == $prefix) { if(substr($k, -(strlen($key))) == $key) return $v; } } return null; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload