title: SEO friendly URLs - from blog.php?articleId=26 to blog/$articleTitle
body: <p>After finally getting my code to post a URL-friendly title to my db (for later use as the SEO optimised URL) I am now looking at how to get my blog script to accept said URL.</p>
  
  <p>Ideally I would like my URLS to appear in a similar way to stack overflows. </p>
  
  <p>Currently my URLs are like this:</p>
  
  <pre><code>blog.php?action=viewArticle&amp;articleId=26
  </code></pre>
  
  <p>I want it to appear like this:</p>
  
  <pre><code>/blog/responsive-layout-design/
  </code></pre>
  
  <p>I have sorted out one side of the script - the side that create the new URL, and saves it in the database but I'm struggling to work out how to implement that on the front end.</p>
  
  <p>I have looked at a few guides and examples dotted around but they only show how to create a URL such as:</p>
  
  <pre><code>store.php?action=viewItem&amp;itemID=34 to store/item/34
  </code></pre>
  
  <p>Obviously, I could do this fairly easily with my URLs, but it's still just going to be displaying an article id, rather than the article title.</p>
  
  <p>This is my current code for pulling articles from the database by ID - how would this be modified to gain the functionality I'm looking for?</p>
  
  <pre><code>function viewArticle() { 
     if ( !isset($_GET["articleId"]) || !$_GET["articleId"] ) { homepage(); return; } 
     $results = array(); 
     $results['article'] = Article::getById( (int)$_GET["articleId"] );      
     $results['pageTitle'] = $results['article']-&gt;title . " | Blog"; 
     require( TEMPLATE_PATH . "/viewArticle.php" ); 
  } 
  </code></pre>