my .htaccess looks like
RewriteEngine On
RewriteRule ^api/([^/]*)$ /api.php?method=$1 [L,QSA]
my api.php looks like
class API {
public function __construct()
{
require_once('helpers.php');
}
public function test()
{
dd('hey');
}
};
$api = new API;
$method = isset( $_GET['method'] ) ? $_GET['method'] : null;
dd($_REQUEST, $_GET);
if( $method && method_exists($api, $method) ){
$api->{$method}();
}
else {
exit("Nothing to see here governor.");
}
Yet when i visit the rewritten url e.g. site.com/api/test i see
array (size=0)
empty
if i change it to /api.php?method=test or /api/test?method=test i get
array (size=1)
'method' => string 'test' (length=4)
Why is the query string not able to be detected?
The server setup is apache 2.2, php-fmt 5.6
Thanks