title: RewriteRule to redirect with url that got parameters
body: <p>I am trying to use RewriteRule inorder to redirect form x page to y page.
  x page got two parameters > products.php?product=$1&amp;page=$2 (myweb.com/products.php?prod...)
  y should be $1/$2/ (myweb.com/$1/$2/)</p>
  
  <p>I tried this one > </p>
  
  <pre><code>Options +FollowSymlinks
  RewriteEngine on
  RewriteBase /
  RewriteRule ^products.php?product=(.*) $1/ [R=301,L]
  </code></pre>
  
  <p>just for testing, and some similiar codes like > <code>/$1/</code> instead <code>$1/</code>, only <code>$1</code>
  I tried to use RewriteCond with query_string but nothing worked....</p>
  
  <p>ofc that there's continue to the htaccess > </p>
  
  <pre><code>RewriteRule ^(.*)/$ $1.php [L]
  </code></pre>
  
  <p>and some more rules which are not relevant (I think)</p>
  
  <p>Can you help me please?</p>
  
  <p>Thanks.</p>
  
  <p>EDIT:</p>
  
  <p>After some massive searches I found the answer!
  this is the answer:</p>
  
  <pre><code>RewriteCond %{QUERY_STRING} ^product=(.*)$
  RewriteRule ^test.php$ %1/? [R=301,L]
  </code></pre>
  
  <p>now for the explanation:
  first of all, added rewritecondition that will match the query string.
  second I remove the query string from the rewrite rule and the $ = the continue (the query string). I also needed to add ? (question mark) at the second part of the rewriterule > <code>%1/?</code> the question mark mean that I dont want to preserve the query string in the new url.</p>