title: $_SERVER['REQUEST_URI'] returns full URL instead of path to script
body: <p>My PHP app is not working because of $_SERVER['REQUEST_URI'] returns the full url to the script instead of a relative path.  </p>
  
  <p><strong>My environment:</strong><br>
  Windows 7 64 bit.<br>
  XAMPP Version 1.8.2<br>
  PHP Version 5.4.16<br>
  Apache Version  Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.16  </p>
  
  <p><strong>My Virtual Host Conf:</strong></p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
  DocumentRoot "D:/HTDOCS/ivankristianto"
  ServerName www.ivankristianto.local
  UseCanonicalName Off
  &lt;Directory "D:/HTDOCS/ivankristianto"&gt;
      Options Indexes FollowSymLinks MultiViews
      AllowOverride all
      Require all granted
  &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>I created a basic script to test the $_SERVER content:  </p>
  
  <pre><code>echo '$_SERVER[\'HTTP_HOST\'] : ' . $_SERVER['HTTP_HOST'];
  echo '&lt;br/&gt;' . '$_SERVER[\'PHP_SELF\'] : ' . $_SERVER['PHP_SELF'];
  echo '&lt;br/&gt;' . '$_SERVER[\'REQUEST_URI\'] : ' . $_SERVER['REQUEST_URI'];
  </code></pre>
  
  <p><strong>And here is the result:</strong></p>
  
  <pre><code>// URL: http://localhost/ivankristianto/request.php
  $_SERVER['HTTP_HOST'] : localhost
  $_SERVER['PHP_SELF'] : /ivankristianto/request.php
  $_SERVER['REQUEST_URI'] : /ivankristianto/request.php //This is correct
  </code></pre>
  
  <p><strong>And</strong></p>
  
  <pre><code>// URL: http://www.ivankristianto.local/request.php
  $_SERVER['HTTP_HOST'] : www.ivankristianto.local
  $_SERVER['PHP_SELF'] : /request.php
  $_SERVER['REQUEST_URI'] : http://www.ivankristianto.local/request.php  //This is wrong
  </code></pre>
  
  <p>I didn't use any proxy, all I did is just set it in my /etc/hosts.  </p>
  
  <p>I have spent hours to find out why this is happens and have been search through google and this website, but cannot find any clue.  </p>
  
  <p>Can you please point me out what's wrong?  </p>
  
  <p>Thanks.<br>
  Ivan</p>