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.