title: htaccess rewrite slug in a url
body: <p>I've searched and searched for help on a rewrite rule but nothing seems to match specifically what I'm trying to do, hopefully someone can help?</p>
  
  <p>I'm trying to replace a slug in a url that could have various other possible slugs before and after it.</p>
  
  <p>e.g.</p>
  
  <pre><code>http://www.example.com/slug/old_slug
  </code></pre>
  
  <p>to</p>
  
  <pre><code>http://www.example.com/slug/new_slug
  </code></pre>
  
  <p>or</p>
  
  <pre><code>/slug/old_slug/slug
  </code></pre>
  
  <p>to</p>
  
  <pre><code>/slug/new_slug/slug
  </code></pre>
  
  <p>or </p>
  
  <pre><code>/slug/old_slug/slug/slug
  </code></pre>
  
  <p>to</p>
  
  <pre><code>/slug/new_slug/slug/slug
  </code></pre>
  
  <p>or finally:</p>
  
  <pre><code>/slug/old_slug/slug?param=1&amp;param=2
  </code></pre>
  
  <p>to</p>
  
  <pre><code>/slug/new_slug/slug?param=1&amp;param=2
  </code></pre>
  
  <p>If that sounds confusing these are products in categories with various possible url parameters after them and I'm having to rename a product that means I want to rewrite the old urls for SEO and inbound links.</p>