Strange URL, what bit fairy explained under this URL

Source: Internet
Author: User
Tags what bit
Strange URL, which fairy explained under this URL
Just entered a PHP project, the system has a page to turn, the browser address bar displays the following URL:
Http://xxx.com/index.php/member-orderPayments-2015071611557932.html

Very not understand, http://xxx.com/index.php/to here, has been defined to a resource, but why there is another resource: member-orderpayments-2015071611557932.html
You fairy to explain, this is why son ah.
Note:
Access to the above URL, the system is working properly, no errors.
And, no matter what I enter url:http://xxx.com/index.php/
or url:http://xxx.com/index.php/member-orderpayments-2015071611557932.html?
The system works correctly and, of course, he turns to different pages.

I just can't understand how the browser analyzes this URL, please do not hesitate to enlighten you.


------to solve the idea----------------------
Should use URL rewriting (urlrewrite) technology, popular point is pseudo-static

Generic URL pass parameter (? Parameter after the number)
http://xxx.com/index.php/member.html?orderPayments=2015071611557932

----------------------------------
Urlrewrite
Http://xxx.com/index.php/member-orderPayments-2015071611557932.html

The following string is parsed by the program to get the arguments
member-orderpayments-2015071611557932
------to solve the idea----------------------
http://xxx.com/index.php /ABC
The resource opened by this URL is still http://xxx.com/index.php
Then/ABC is received as a parameter by index.php inside the code, and then made to handle,
This is the single-entry processing of the frame.

If you add urlwrite after
Http://xxx.com /ABC
will still be given to http://xxx.com/index.php to deal with,/ABC as a parameter
------to solve the idea----------------------
The purpose of doing this may be to do SEO easy to ingest or make the address look better
It is not necessary to use Urlrewrite (can also, if used urlrewrite, the middle of the index.php can be further removed)

echo "
";
Preg_match ('/\/([a-z0-9a-z]+) \-([a-z0-9a-z]+] \-([0-9]+] \.html/', $_server[' path_info '], $values);
Print_r ($values);
echo "
";


Array
(
[0] =/member-orderpayments-2015071611557932.html
[1] = Member
[2] = orderpayments
[3] = 2015071611557932
)

------to solve the idea----------------------
The main reason in this way is that PHP natively supports this expression by using $_server[' path_info '] to get the string segment behind index.php/, without any setting of the server, which looks like a pseudo-static path with rewrite. Because if the real rewrite, it is necessary to support the server itself, and also write rewrite rules.
  • 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.