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?
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?
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.