buzibuzi
buzibuzi

Reputation: 734

Rewrite rule returning empty $_GET parameter

continuing from the point where this question was answered,

im using this rule in my .htaccess file:

# 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]

moving on, at some point after the page has loaded, a user performs a facebook login which redirects back to this originating page but adds an authentication code:

 map/פבריגט/חולון/ישראל?code=Facebook_Auth

problem is "Code" parameter is not passed.

i tried to add this rule before the first rule mentioned above:

#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]

but for this url:

/map/פבריגט/חולון/ישראל?code=abc

the $_GET array outputs

'address' => string UTF-8 (18) "פבריגט/חולון/ישראל"
'code' => string (0) ""

what rule should i use to intercept the "code" parameter ? any help will be welcome. Thank you !

Upvotes: 1

Views: 528

Answers (1)

anubhava
anubhava

Reputation: 785128

You need additional QSA flag (Query String Append) in your RewriteRule.

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

Upvotes: 3

Related Questions