title: keeping GET variables after URL rewrite
body: <p>im trying to rewrite my product page URLs which are dynamic</p>
  
  <p>an example of one is:</p>
  
  <pre><code>product.php?id=780-1AC930D
  </code></pre>
  
  <p>and Im trying to rewrite it to:</p>
  
  <p>product/780-1AC930D</p>
  
  <p>i need the variable to still pass through with the URL though but currently its not working for me.</p>
  
  <p>I have a redirect at the top of the <code>product.php</code> page something like this:</p>
  
  <pre><code>$prodID = $_GET['id'];
      if(!isset($prodID) &amp;&amp; $prodId == ""){
          header( 'Location: http://www.***********.com' ) ;
      }       
      else{
  </code></pre>
  
  <p>and I know the GET variable isnt passing through because it keeps redirecting me.</p>
  
  <p>the code I have for the HTACCESS file is this:</p>
  
  <pre><code> Options FollowSymLinks
  RewriteEngine On
  RewriteBase / 
  RewriteRule ^product/(.*)$ /product.php?id=$1 [QSA]
  </code></pre>
  
  <p>and the HTML for the URL is:</p>
  
  <pre><code>&lt;a href = "product/&lt;?php echo $product[$i]['catID'];?&gt;"&gt;
  </code></pre>
  
  <p>does anybody have a clue why this isnt working?</p>
  
  <p>EDIT to give more information.</p>
  
  <p>This is my entire HTACCESS file</p>
  
  <pre><code>Options FollowSymLinks
  RewriteEngine On
  RewriteBase / 
  
  RewriteRule ^product/(.*)$ /product.php?id=$1 [QSA]
  
  ## If the request is for a valid directory
  RewriteCond %{REQUEST_FILENAME} -d [OR]
  
  ## If the request is for a valid file
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  
  ## If the request is for a valid link
  RewriteCond %{REQUEST_FILENAME} -l
  
  ## don't do anything
  RewriteRule ^ - [L]
  RewriteRule ^([^/.]+)/([^/]+)/?$ /$1.php?cat=$2 [L,QSA]
  
  RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+([^.]+)\.php\?cat=([^\s&amp;]+)&amp;subCat=([^\s&amp;]+)\s [NC]
  RewriteRule ^ /%1/%2/%3? [R=301,L]
  
  RewriteRule ^([^/.]+)/([^/]+)/([^/]+)/?$ /$1.php?cat=$2&amp;subCat=$3 [L,QSA]
  
  RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+([^.]+)\.php\?cat=([^\s&amp;]+)\s [NC]
  RewriteRule ^ /%1/%2? [R=301,L]
  
  
  # REMOVE PHP EXTENSIONS
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ $1.php [L,QSA]
  </code></pre>
  
  <p>I just moved <code>RewriteRule ^product/(.*)$ /product.php?id=$1 [QSA]</code> from above the "# REMOVE PHP EXTENSIONS" to below the RewriteBase and it appears to fix my problem.</p>
  
  <p>The other rewrite rules are for my category and sub category pages before you actually make it to a product page.</p>
  
  <p>So im curious as to why placing this product.php line above this other stuff has done it?</p>