Simple implementation of url_php tutorial for search Engine friendly with PHP

Source: Internet
Author: User
Last time I wrote the search Engine friendly URL design-I'm tossing on this thing, to achieve this http://www.myhost.com/foo.php (as the current mainstream development language)? A=a&b=b&c=c- > http://www.myhost.com/foo.php (as the current mainstream development language)/a/a/b/b/c/c URL conversion, there are actually different ways.

For example, I use a virtual host, but also want to implement URL optimization, but I do not have server permissions, this time can be from Path_info.

Visit http://www.myhost.com/foo.php (as the current mainstream development language) when/a/a/b/b/c/c this URL, if Apache (Unix platform is the most popular Web server platform) Allowpathinfo has been opened, using PHP (as the current mainstream development language) to access $_server[path_info] can get a/a/b/b/c/c this string of characters at this time and then use PHP (as the mainstream development language now) to parse:

PLAIN textphp (as the current mainstream development language):

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];
}

This makes it easy to convert path_info to a global $_get array, which has the benefit of

Http://www.myhost.com/foo.php (as the current mainstream development language)? a=a&b=b&c=c
Http://www.myhost.com/foo.php (as the current mainstream development language)/A/A/B/B/C/C
The above URL can be accessed at the same time, ensuring versatility

http://www.bkjia.com/PHPjc/508680.html www.bkjia.com true http://www.bkjia.com/PHPjc/508680.html techarticle last time I wrote the search Engine Friendly's URL design-I toss this thing, to achieve this http://www.myhost.com/foo.php (as the current mainstream development language)? a=ab=bc=c-http:// W ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.