隐藏查询字符串参数htaccess

时间:2012-11-20 09:24:19

标签: php mysql .htaccess querystringparameter

您好我想询问如何使用.htaccess mod_write将http://abc.tk/comments.php?post_referrel_id=16转换为http://abc.tk/comments.php?post_referrel_id/16 表示用户看到此链接 abc.tk/comments.php?post_referrel_id/16 当他点击有源的超链接时 abc.tk/comments.php?post_referrel_id=16

3 个答案:

答案 0 :(得分:0)

先生,你需要研究。 检查这个简单tuto

要获得提示,请不要在重写的网址中使用?

这是一个快速代码(在重写的网址中使用?

RewriteEngine on
RewriteRule ^comment.php?post_referrel_id/([0-9]+)$ comment.php?post_referrel_id=$1

答案 1 :(得分:0)

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^comments.php?post_referrel_id/(.*)$ comments.php/post_referrel_id=$1 [L,QSA]

您可能需要从一个表单添加重定向到另一个表单。上面的代码告诉服务器/ 16与= 16

相同

答案 2 :(得分:0)

使用以下代码行:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^abc.tk
RewriteRule ^comments.php?post_referrel_id=([0-9]+)$ comments.php?post_referrel_id/$1 [R=301,L]

这会将comments.php?post_referrel_id=16重定向到comments.php?post_referrel_id/16

相关问题