title: How to write .htaccess for twitter API like urls
body: <p>I'd like to write a proper .htaccess rule and PHP code to parse url like this one : <a href="https://myapi.com/1.1/users/search.json?q=abc&amp;page=1&amp;count=3" rel="nofollow">https://myapi.com/1.1/users/search.json?q=abc&amp;page=1&amp;count=3</a></p>
  
  <p>Here's what I found so far:</p>
  
  <pre><code>RewriteRule ^([a-zA-Z_-])\.(xml|json)$   index.php?url=$1&amp;format=$2
  </code></pre>
  
  <p>And my PHP code looks like</p>
  
  <pre><code>$requestParts = explode('/', $_GET['url']);
  $contentType = $_GET['type'];
  //$params = ... //Here's where I'm lost
  </code></pre>
  
  <p>How can I get the optional part with the RewriteRule and PHP code ?</p>