title: PHP Rewrite url and preserve posted data
body: <p>I have a php server and i want to rewrite incoming urls. Since incoming requests are post requests I also want posted data to be transferred at the new urls.</p>
  
  <p>I have managed to redirect urls with the following rewrite rules:</p>
  
  <pre><code>RewriteRule ^test/(.*)$ http: //localhost/index.php?data=&amp;1 [NC,L]
  </code></pre>
  
  <p>or</p>
  
  <pre><code>RewriteRule ^test/(.*)$ http: //localhost/index.php?data=&amp;1 [NC,R=301]
  </code></pre>
  
  <p>I have also managed to preserve post data with the following rewrite rule:</p>
  
  <pre><code>RewriteRule ^test/(.*)$ http: //localhost/index.php?data=&amp;1 [P]
  </code></pre>
  
  <p>The problem is that I can not both of them at the same time. What am I doing wrong? Is there a way to redirect url and keep post data?</p>