title: SEO URL based on category name without have a category id in URL
body: <p>I have two table <code>posts</code> &amp; <code>categories</code></p>
  
  <pre><code>post_id | post_title  | post_content   | post_cat
  --------------------------------------------------
  1         Hello World  welcome to my..   1
  .         ..           ..                ..
  </code></pre>
  
  <p><code>categories</code> table</p>
  
  <pre><code>cat_id | cat_name | cat_parent
  -----------------------------
  1        News       NULL
  2        Sports     1
  .        ...        .. 
  </code></pre>
  
  <p>Let's say current category link for news is <code>http://domain.com/category/1/</code></p>
  
  <p>MySQL statment</p>
  
  <pre><code>SELECT posts.post_id,
         posts.post_id,
         posts.post_title,
         posts.post_content,
         posts.post_cat,
         categories.cat_id,
         categories.cat_name,
         categories.cat_parent
  FROM   posts
         INNER JOIN categories
           ON posts.post_cat = categories.cat_id  
         WHERE posts.post_cat = (int)$_GET['cat_id']
  </code></pre>
  
  <p>So we can get a result for <code>post_cat = 1</code> </p>
  
  <p>According to my current database structure, how do I remove the <code>ID</code> but change it to be a nice slug? Example :- </p>
  
  <pre><code>Main category - http://domain.com/category/news/
  Sub category  - http://domain.com/category/news/sports/
  </code></pre>
  
  <p>Let me know a clue how script will tell <code>News</code> is equal <code>1</code> on <code>post_cat</code> column?</p>