Is there's a method to get query string in PHP?


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/$ /List.php?categories=$1 [L]

I wish to capture groups value in PHP .Please be aware the parameter format '/cars/BMW/'

You access the worthiness exactly like you accustomed to so to obtain the cars value you'd simply do this.

echo $_GET['categories'];

should echo out


In PHP, can get on via $_GET['categories'], and employ the explode() function to split up the various components around the /:

if (isset($_GET['categories']))
  $parts = explode("/", $_GET['categories']);
  $vehicle_type = $parts[0];
  $vehicle_make = $parts[1];

  echo $vehicle_type . " ";
  echo $vehicle_make;

You can test the next:

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^categories=(.*)
RewriteRule .* /List.php?categories=$1 [L]

This can capture whatever uses groups within the query-string and put it on within the rule.