Delirium tremens
Delirium tremens

Reputation:

RewriteRule not obeyed

http://localhost/allsides/.htaccess

RewriteRule (.*) index.php?$1 [L]

http://localhost/allsides/test

One or more chars after allsides/ are saved in $1

$_GET is $1.

test is not $_GET!

What is wrong?

Upvotes: 0

Views: 144

Answers (1)

Gumbo
Gumbo

Reputation: 655309

When …?test is requested, $_GET’s first element’s key will be test an has no value (equal to …?test=).

So either use current(array_keys($_GET)) to get the key of the first element of $_GET or use $_SERVER['QUERY_STRING'] to get the full query.

Upvotes: 2

Related Questions