mod-rewrite和$ _ GET变量变量、mod、rewrite、GET

2023-09-02 00:30:12 作者:醉酒成梦

我有一个非常简单的MOD-重写规则:

 重写规则^(。*)$的index.php?URL = $ 1 [PT,L]
 

作为一个例子,它正在改变一个网址 www.mysite.com/a/b www.mysite.com?url=a / B

问题在这里是不允许通过获得的参数来我的PHP。

在如何改造 www.mysite.com/a/b?bar=42&foo=43 www.mysite任何线索。 ?COM URL = / A / B和巴= 42安培;富= 43

在此先感谢!

解决方案

 重写规则。的index.php?URL = $ 1 [PT,L,QSA]
 
Nginx Rewrite模块 理论篇

QSA =查询字符串附加

I have a really simple mod-rewrite rule :

RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

As an example, it is transforming an url www.mysite.com/a/b to www.mysite.com?url=a/b

Issue here is that is does not allow to pass get parameters to my php.

Any clue on how to transform www.mysite.com/a/b?bar=42&foo=43 to www.mysite.com?url=/a/b&bar=42&foo=43

thanks in advance !

解决方案

RewriteRule . index.php?url=$1 [PT,L,QSA]

QSA = Query String Append