title: Rewrite PHP query string?
body: <p>I've searched for other solutions to rewriting a URL using the .htaccess file at the root of my server, but the language is pretty confusing to me, and I can't seem to get it to work. How would I go about changing:</p>
  
  <pre><code>http://domain.com/share.php?media=059ogbuq70
  </code></pre>
  
  <p>to:</p>
  
  <pre><code>http://domain.com/059ogbuq70
  </code></pre>
  
  <p>I found code similar to this, and tried it, but it didn't seem to work:</p>
  
  <pre><code>RewriteEngine on
  RewriteCond %{QUERY_STRING} ^media=([0-9]+)$
  RewriteRule ^$ share.php?media=$1 [QSA,L]
  </code></pre>
  
  <p>My PHP:</p>
  
  <pre><code>&lt;?php
  $media_id = $_GET['media'];
  $url = file_get_contents("https://api.wistia.com/v1/medias/" . $media_id . ".json?api_password=my_key");
  $json = json_decode($url, true);
  $name = $json[name];
  $origimg = $json['thumbnail'][url];
  list($image, $size) = explode('?', $origimg);
  $video = $json['assets'][5][url];
  ?&gt;
  </code></pre>
  
  <p>I then <code>echo</code> the variables where I need them on my page.</p>
  
  <p>Thank you!</p>