title: PHP_SELF vs PATH_INFO vs SCRIPT_NAME vs REQUEST_URI
body: <p>I am building a PHP application in CodeIgniter. CodeIgniter sends all requests to the main controller: <code>index.php</code>. However, I don't like to see <code>index.php</code> in the URI. For example, <code>http://www.example.com/faq/whatever</code> will route to <code>http://www.example.com/index.php/faq/whatever</code>. I need a reliable way for a script to know what it's address is, so it will know what to do with the navigation. I've used <code>mod_rewrite</code>, as per CodeIgniter documentation.</p>
  
  <p>The rule is as follows:</p>
  
  <pre><code>RewriteEngine on
  RewriteCond $1 !^(images|inc|favicon\.ico|index\.php|robots\.txt)
  RewriteRule ^(.*)$ /index.php/$1 [L] 
  </code></pre>
  
  <p>Normally, I would just check <code>php_self</code>, but in this case it's always <code>index.php</code>. I can get it from <code>REQUEST_URI</code>, <code>PATH_INFO</code>, etc., but I'm trying to decide which will be most reliable. Does anyone know (or know where to find) the real difference between <code>PHP_SELF</code>, <code>PATH_INFO</code>, <code>SCRIPT_NAME</code>, and <code>REQUEST_URI</code>? Thanks for your help!</p>
  
  <p><strong>Note</strong>: I've had to add spaces, as SO sees the underscore, and makes it italic for some reason. </p>
  
  <p><strong>Updated</strong>: Fixed the spaces.</p>