分享、学习、提高
2008/06/24 19:27
有个搜索框,搜索后实现地址是show.php?q=xxx,想让其显示为show.html?q=xxx,通过Rewrite实现。

直接想当然的写出:
RewriteRule ^show.html?q=(\w+)$  show.php?q=$1


失败,根本不认这条。

查了下文档,似乎应该用RewriteCond来实现,测试了N回,终于成功。
RewriteCond %{QUERY_STRING} ^(q=.*)$
RewriteRule ^show.html(.*) show.php?%1 [L]


%1就是获取到的q=xxx啦:)
相关日志
061124学习记录
发表评论
表情
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]