title: htaccess rewrite url like Stack Overflow
body: <p>Stack Overflow generates rewrite URLs,</p>
  
  <p>so i need to know how i can do it like Stack Overflow?</p>
  
  <pre><code>http://stackoverflow.com/questions/9168364/how-to-rewrite-seo-friendly-urls-like-stackoverflow =&gt; 200 ok.(without trailing slash)
  http://stackoverflow.com/questions/9168364/how-to-rewrite-seo-friendly-urls-like-stackoverflow/ =&gt; 200 ok.(with trailing slash)
  http://stackoverflow.com/questions/9168364/ =&gt; 301 redirect.
  http://stackoverflow.com/questions/9168364  =&gt; 301 redirect.
  </code></pre>
  
  <p>How i can do it with mod_rewrite ?</p>
  
  <p>i have something like this:</p>
  
  <pre><code>RewriteRule ^([0-9]+)[/]([^/]*) ./cat.php?id=$1&amp;title=$2 [L,NC]
  
  
  
  mydomain.com/999 =&gt; 404 not found.
  mydomain.com/999/ =&gt; 200 ok.
  mydomain.com/999/test =&gt; 200 ok.
  mydomain.com/999/test/test2 =&gt; 200 ok.
  mydomain.com/999/test/test2/test3 =&gt; 200 ok.
  mydomain.com/999/test/test2/test3/test4 =&gt; 200 ok.
  </code></pre>
  
  <p>please let me know how i change RewriteRule ?</p>