title: Remove .php and id from url and replace with slash
body: <p>i have tried lots of for url rewrite rules in htaccess but i am stuck now. i have to change this url </p>
  
  <pre><code>products.php?id=31
  </code></pre>
  
  <p>to</p>
  
  <pre><code>products/31 
  </code></pre>
  
  <p>i have used </p>
  
  <pre><code>   Options +FollowSymLinks -MultiViews
     # Turn mod_rewrite on
     RewriteEngine On
     RewriteBase /
  
    ## don't touch /forum URIs
    RewriteRule ^forums/ - [L,NC]
  
    ## hide .php extension snippet
  
    # To externally redirect /dir/foo.php to /dir/foo
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
    RewriteRule ^ %1 [R,L]
  
    # To internally forward /dir/foo to /dir/foo.php
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}.php -f
    RewriteRule ^(.*?)/?$ $1.php [L]
  </code></pre>
  
  <p>using this i get the following result: </p>
  
  <pre><code>products?id=31
  </code></pre>
  
  <p>But this isn't working. Any ideas?</p>