title: Apache rewrite - get original URL in PHP
body: <p>I have a rewrite in nginx or Apache for this address:</p>
  
  <pre><code>http://domain.com/hello
  </code></pre>
  
  <p>to a script like</p>
  
  <pre><code>http://domain.com/test.php&amp;ref=hell
  </code></pre>
  
  <p>How can I access this rewritten URL in PHP? Because, if I use <code>$_SERVER['REQUEST_URI']</code> of course I get:</p>
  
  <pre><code>/test.php&amp;ref=hell
  </code></pre>
  
  <p>but I only want:</p>
  
  <pre><code>/hello
  </code></pre>
  
  <p>Is this possible? Thanx for help.</p>
  
  <p><strong>Upd nginx cnf</strong></p>
  
  <pre><code>proxy_redirect off;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  
  server
  {
    listen 80;
    server_name domain.test;
  
  
    location /
    {
      rewrite ^/(main|best|air)$ /core/feeds.php?act=$1 last;
      proxy_pass http://127.0.0.1:8080;
    }
  }
  </code></pre>