Last time I wrote about the URL design of Search Engine Friendly - I was struggling with this matter and wanted to achieve this http://www.myhost.com/foo.php?a=A&b=B&c=C -> http://www. There are actually different ways to convert the URL of myhost.com/foo.php/a/A/b/B/c/C .
For example, I use a virtual host and want to optimize the URL, but I don’t have a server. Permissions, you can start from PATH_INFO at this time.
When accessing the URL http://www.myhost.com/foo.php/a/A/b/B/c/C , if Apache’s AllowPathinfo has been turned on, use php Access $_SERVER['PATH_INFO'] to get the string of characters a/A/b/B/c/C. Then use php to parse it:
PLAIN TEXTPHP:
if(!empty($_SERVER['PATH_INFO'])) {
$paths = explode('/', substr($_SERVER['PATH_INFO'], 1));
for($i = 0, $cnt = count($paths); $i <$cnt; $i++)
$_GET[$paths[$i]] = @(string)$paths[++$i];
}
In this way, you can simply convert PATH_INFO into the global $_GET array, which also has the advantage of
http://www.myhost.com/foo.php?a=A&b=B&c=C
http://www.myhost.com/foo.php/a/A/b/B/c/C
The above URLs can be accessed at the same time, ensuring versatility.