title: url rewrite and redirect - php
body: <p>I recently developed a web site using php which accepts a id as its input via get.
  <a href="http://website.com/profile.php?id=123" rel="nofollow">http://website.com/profile.php?id=123</a>. its the old fashion way, I've seen sites use pretty url's like <a href="http://website.com/username.html" rel="nofollow">http://website.com/username.html</a></p>
  
  <p>So in order to archive this, i managed to do some research and end up with this code blow.
  Also i'm passing the username in the query string.
  <a href="http://website.com/profile.php?id=123&amp;username=test_user" rel="nofollow">http://website.com/profile.php?id=123&amp;username=test_user</a>
  the parameter <strong>ID</strong> is only used as a input for the <strong>profile.php</strong></p>
  
  <pre><code>RewriteEngine On
  RewriteBase /
  
  RewriteCond %{THE_REQUEST}      /profile.php     [NC]
  RewriteCond %{QUERY_STRING}     ^id=([^&amp;]+)&amp;username=([^&amp;]+) [NC]
  RewriteRule ^.*                 http://%{HTTP_HOST}/%2.html [R=301,L]
  </code></pre>
  
  <p>The final output i seek is <a href="http://website.com/username.html" rel="nofollow">http://website.com/username.html</a></p>
  
  <p>Is their anything wrong in this ? this doesn't seem to work. Am i doing something wrong ? if so please be kind to let me know where my error lies. Thank you.</p>