开发者

How to mod_rewrite just one querystring parameter?

I would like to rewrite the following URL:

mypage/1234/myaction?api开发者_StackOverflow社区_key=4567

to:

api/myaction.php?id=1234&api_key=4567

...using mod-rewrite. I can get /mypage/1234/myaction -> api/myaction.php?id=1234, but the extra get parameter is causing some problems....

Any ideas?


Use the QSA (query string append) flag:

RewriteRule mypage/(\d+)/myaction api/myaction.php?id=$1 [QSA]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜