title: URL Rewrite rule - subfolder to query string value
body: <p>I'm trying to create a rule the will take the subfolder from the URL and convert that to a query string value for example:</p>
  
  <p>If I navigated to this URL: <code>http://www.example.com/myfolder</code>
  I would like that to read <code>http://www.example.com/default.aspx?folder=myfolder</code></p>
  
  <p>This is where I'm up to:</p>
  
  <pre><code>&lt;rule name="Rewrite Language"&gt;
    &lt;match url="([a-z]{2})(.*)" /&gt;
    &lt;conditions logicalGrouping="MatchAll"&gt;
      &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /&gt;
      &lt;add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /&gt;
    &lt;/conditions&gt;
    &lt;action type="Rewrite" url="/default.aspx?code={R:2}" /&gt;
  &lt;/rule&gt;
  </code></pre>
  
  <p>but this doesn't return the full subfolder value. I'll be honest I've stole this from a similar issue from this site, and I must confess I really have no idea what it all means!</p>
  
  <p>I might be approaching this in the wrong way, my issue is that I can't be sure what the subfolder will be as this is generated dynamically from a random 6 character alphanumeric value.</p>
  
  <p>Any help would be very much appreciated.</p>
  
  <p>David</p>