title: Rewriting / Redirecting URLs using .htaccess file
body: <p>I am looking for the correct code to place in a .htaccess file that will redirect this:</p>
  
  <pre><code>http://www.website.com/title_of_a_post_003424.html
  </code></pre>
  
  <p>to look like this</p>
  
  <pre><code>http://www.website.com/title-of-a-post/
  </code></pre>
  
  <p>Things to note about the change: </p>
  
  <ol>
  <li>The title of each post will be different, and the numbers will be different. </li>
  <li>Titles will be up to 40 characters. Numbers will always be 6 digits in length</li>
  <li>Underscores are replaced with dashes</li>
  <li><code>.html</code> is removed and replaced with a forward slash</li>
  </ol>
  
  <p>Lastly, if at all possible this change would also use a 301 redirect so that search engines replace old links with new links.</p>
  
  <p>All help or ideas would be greatly appreciated!</p>