title: Htaccess - Rewrite and Redirect URL with PHP GET variable
body: <p>I am trying to both rewrite and redirect this URL:</p>
  
  <pre><code>https://www.domain.com/video-lessons-page.php?item=stocks
  </code></pre>
  
  <p>to go to this URL:</p>
  
  <pre><code>https://www.domain.com/stocks-video-lessons
  </code></pre>
  
  <p>Here is the code I'm currently working with:</p>
  
  <pre><code>RewriteCond %{QUERY_STRING} ^item=([^&amp;]+)
  RewriteRule ^/?video-lessons-page\.php$ https://www.domain.com/%1-video-lessons? [R=301,L]
  RewriteRule ^(stocks|finance|accounting)-video-lessons$ video-lessons-page.php?item=$1 [NC,L]
  </code></pre>
  
  <p>Unfortunately with the above code I'm having issues. The first two lines work great by themselves in that it redirects <code>/video-lessons-page.php?item=stocks</code> to <code>/stocks-video-lessons</code>.</p>
  
  <p>And the third line also works great by itself to where the <code>/stocks-video-lessons</code> URL functions correctly with the GET variable and the page's code.</p>
  
  <p>But putting them together is problematic. Right now I'm getting errors like "www.domain.com redirected you too many times." etc. Any ideas?</p>