TheJokersThief
TheJokersThief

Reputation: 138

Can't get $_GET variables from mod_rewritten URL

I'm trying to rewrite a URL in PHP from example.com/homehub/whatweneed.php?sort=default to example.com/homehub/whatweneed/sort/default.

I've got the following code in my .htaccess file:

RewriteEngine On
RewriteRule ^sort/([A-Za-z0-9]+)/?$ ^whatweneed.php?sort=$1 [QSA,PT,L]

It's rewriting the URL to what I want but I can't seem to get any of the variables passed through via $_GET.

Upvotes: 1

Views: 459

Answers (1)

John Smith
John Smith

Reputation: 478

Try

$_SERVER['REQUEST_URI']

or

$_SERVER['REDIRECT_URL']

Upvotes: 1

Related Questions