views:

87

answers:

1

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?

+2  A: 

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.

Gumbo
Hmmm... how to make $_GET be the one or more chars after allsides?
Change your rule to `index.php?path=$1` and look in `$_GET["path"]`.
Ben Blank
print_r($_GET);Array ( index.php => ) (.*)/?(.*)/?(.*) index.php?controller=$1Array ( [controller] => index.php [action] => [params] => )What is going on?
Gumbo
IT WORKS!!! thanks a lot, man!