Regex 重写规则返回空$\u GET参数

Regex 重写规则返回空$\u GET参数,regex,apache,.htaccess,mod-rewrite,Regex,Apache,.htaccess,Mod Rewrite,从被回答的地方继续 我在我的.htaccess文件中使用此规则: # Internally forward /map/abc to /location.php?address=abc RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^map/(.*)/?$ /location.php?address=$1 [NC,L] 接着,在页面加载后的某个时刻,用户执行facebook登

从被回答的地方继续

我在我的.htaccess文件中使用此规则:

# Internally forward /map/abc to /location.php?address=abc
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^map/(.*)/?$ /location.php?address=$1 [NC,L]
接着,在页面加载后的某个时刻,用户执行facebook登录,该登录会重定向回该原始页面,但会添加身份验证代码:

 map/פבריגט/חולון/ישראל?code=Facebook_Auth
问题是“代码”参数未传递

我试图在上述第一条规则之前添加此规则:

#first rule to Internally forward /map to /location.php?address=abc&code=yxz and get code
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^map/(.*)/?(.*)$ /location.php?address=$1&code=$2 [NC,L]
但对于此url:

/map/פבריגט/חולון/ישראל?code=abc
$\u获取数组输出

'address' => string UTF-8 (18) "פבריגט/חולון/ישראל"
'code' => string (0) ""
我应该使用什么规则拦截“code”参数? 欢迎任何帮助。
谢谢大家!

您需要在
重写规则
中添加
QSA
标志(查询字符串追加)

RewriteRule ^map/(.*?)/?$ /location.php?address=$1 [NC,L,QSA]