title: url rewrite using php and .htaccess
body: <p>this question is Basic but important. i need to rewrite php url using .htaccess . e.x one : i have many file with <code>.php</code> extension . e.x two : i need seo url friendly with name and <code>html</code> extension.</p>
  
  <p>example 1 : </p>
  
  <pre><code>http://mydomain.com/editname.php
  http://mydomain.com/location.php
  .....
  </code></pre>
  
  <p>I need to rewrite all to  :</p>
  
  <pre><code>http://mydomain.com/editname/
  http://mydomain.com/location/
  </code></pre>
  
  <p>example 2 : </p>
  
  <pre><code>http://mydomain.com/name.php?id=1
  http://mydomain.com/state.php?id=1
  </code></pre>
  
  <p>rewrite to : ( john &amp; bsw is really name and inserted to mysql)</p>
  
  <pre><code>http://mydomain.com/name/1/john.html
  http://mydomain.com/state/1/bsw.html
  </code></pre>
  
  <p><strong>NOTE</strong> : If non of this, redirect to 404 not found page. </p>
  
  <p>thanks.</p>