title: Pros/cons of using index.php?q=path/ instead of index.php/path/ when routing URLs?
body: <p>I'm writing a simple method to map routes to files and I've come across two ways to do it.</p>
  
  <p>The first, and I guess used by most frameworks, is using the $_SERVER['REQUEST_URI'] variable to extract everything after index.php:</p>
  
  <pre><code>RewriteRule ^(.*)$ index.php [QSA,L]
  </code></pre>
  
  <p>The second way is used in Drupal, and the route is simply passed as a query string.</p>
  
  <pre><code>RewriteRule ^(.*)$ index.php?q=$1 [QSA,L]
  </code></pre>
  
  <p>Now, the "Drupal way" seems a lot simpler to me. With the other method you'd have to use "explode" on both $_SERVER['REQUEST_URI'] and $_SERVER['SCRIPT_NAME'] and then use something like array_diff_assoc to remove the script name and subdirectory name, if there is one. It's not THAT much work, but if with the Drupal way you can simply extract the $_GET['q'] value, why nobody does it that way? What are the disadvantages, if any?</p>
  
  <p>Thanks.</p>