mod_rewrite的:检查URL的自定义查询字符串? [英] mod_rewrite: Check for Custom query string in URL?

查看:112
本文介绍了mod_rewrite的:检查URL的自定义查询字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用URL重写在我的新项目。但我也需要允许在URL自定义查询刺痛。

I'm trying to use URL rewrite in my new project. But I also need to allow custom query sting in URL.

我只是想知道如何编写规则重写此网址

I just want to know how to write rewrite rule for this URL

http://www.mysite.com/edit/123 ?/ Q1 =值1&放大器; Q2 = VALUE2

要成为这个

http://www.mysite.com/index.php?action=edit&id=123&q1=value1&q2=value2

自定义查询字符串应该被允许无限制。

The custom query string should be allow unlimited.

由于数以百万计的...

Millions of Thanks...

推荐答案

简单地做您的规则与其他任何规则,并在末尾添加QSA修饰符(查询字符串追加)。

Simply do your rule as any other rule and add the QSA modifier (Query String Append) at the end.

RewriteEngine On
RewriteRule ^/([A-Za-z0-9]+)/([0-9]+)/$ index.php?action=$1&id=$2 [L,QSA]

这篇关于mod_rewrite的:检查URL的自定义查询字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆