用.htaccess参数重写多个php查询

site.com/information.php?country=usa&state=co&city=denver

to

site.com/info/usa/co/denver

.htaccess

RewriteEngine On
RewriteRule ^info/([^/]+)/(.*)$/(.*)$ information.php?country=$1&state=$2&city=$3   [L]
RewriteRule ^info/([^/]+)/(.*)$ information.php?country=$1&state=$2                 [L]
RewriteRule ^info/([^/]+) informationl.php?country=$1                               [L]

information.php

<?php
echo $_GET["country"].'<br>';
echo $_GET["state"].'<br>';
echo $_GET["city"].'<br>';
echo $_SERVER['QUERY_STRING']'<br>';
?>

The first two query works fine but it wont catch the third one, well it does but it attach it to the 2nd query

usa

co/denver

country=usa&state=co/denver

I think im missing something, can anyone help me ?

You have two $'s in there. This symbol means "end of the match", so you're "city" parameter is getting gobbled up by the "state" one. Try:

RewriteEngine On
RewriteRule ^info/([^/]+)/([^/]+)/([^/]+)$ information.php?country=$1&state=$2&city=$3   [L]
RewriteRule ^info/([^/]+)/([^/]+)$ information.php?country=$1&state=$2                 [L]
RewriteRule ^info/([^/]+) informationl.php?country=$1                               [L]