title: Url rewriting with Apache mod_rewrite
body: <p>In my PHP web page I want to redirect as follows:</p>
  
  <pre><code>header("Location: page2.php?id=$tid");
  </code></pre>
  
  <p>The querystring is needed by page2.php, but I don't want the querystring displayed in the visitor's browser. I thought I could eliminate the querystring using mod_rewrite as follows:</p>
  
  <pre><code>RewriteEngine On
  RewriteRule ^page2\.php page2\.php?
  </code></pre>
  
  <p>This just removes the query string for page2.php (making it behave in a way not desired), and still displays the query string in the browser's url display area. </p>
  
  <p>I found other references on removing querystrings, like <a href="https://stackoverflow.com/questions/3457022/mod-rewrite-remove-query-string-from-url">mod_rewrite: remove query string from URL?</a> , but when I add redirection to the rule like [R=permanent], the url displayed by my browser goes from</p>
  
  <pre><code>localhost/admin/page2.php?id=123
  </code></pre>
  
  <p>with by a web page that displays just fine, to</p>
  
  <pre><code>http://localhost/C:/xampp/htdocs/admin/page2.php
  </code></pre>
  
  <p>where the web page is not loaded, but instead the following is displayed:</p>
  
  <pre><code>Access forbidden!
  
  You don't have permission to access the requested object. 
  It is either read-protected or not readable by the server.
  
  If you think this is a server error, please contact the webmaster.
  
  Error 403
  
  localhost
  9/5/2011 9:57:19 PM
  Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
  </code></pre>
  
  <p>How can I redirect to a page that needs a querystring, but hide that querystring from the visitor so that it is not displayed to them by their browser?</p>