Php 使用ApacheModu重写进行Url重写

Php 使用ApacheModu重写进行Url重写,php,apache,url,mod-rewrite,query-string,Php,Apache,Url,Mod Rewrite,Query String,在我的PHP网页中,我想重定向如下: header("Location: page2.php?id=$tid"); RewriteEngine On RewriteRule ^page2\.php page2\.php? page2.php需要查询字符串,但我不希望在访问者的浏览器中显示查询字符串。我想我可以使用mod_rewrite消除查询字符串,如下所示: header("Location: page2.php?id=$tid"); RewriteEngine On RewriteRu

在我的PHP网页中,我想重定向如下:

header("Location: page2.php?id=$tid");
RewriteEngine On
RewriteRule ^page2\.php page2\.php?
page2.php需要查询字符串,但我不希望在访问者的浏览器中显示查询字符串。我想我可以使用mod_rewrite消除查询字符串,如下所示:

header("Location: page2.php?id=$tid");
RewriteEngine On
RewriteRule ^page2\.php page2\.php?
这只是删除了page2.php的查询字符串(使其以不希望的方式运行),并且仍然在浏览器的url显示区域中显示查询字符串

我找到了关于删除querystring的其他引用,如,但当我向规则添加重定向(如[R=permanent])时,我的浏览器显示的url从

localhost/admin/page2.php?id=123
通过一个显示良好的网页

http://localhost/C:/xampp/htdocs/admin/page2.php
未加载网页,但显示以下内容:

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

如何重定向到需要查询字符串的页面,但是,对访问者隐藏该查询字符串,使其不会通过浏览器显示给他们?

看看这篇博客文章-

看看这篇博客文章-

。htaccess和mod_rewrite通常在localhosts中不起作用。您是否有其他方法将tid传递到page2.php?其次,URL重写不能用于修改浏览器中显示的URL。它用于在内部将漂亮的URL转换为丑陋的URL。.htaccess和mod_rewrite在localhosts中通常不起作用您有没有其他方法将tid传递到page2.php?其次,URL重写不能用于修改浏览器中显示的URL。它用于在内部将漂亮的URL转换为丑陋的URL。