$_SERVER['QUERY_STRING'] become empty if the url change

3265 views php
3

I have a problem to resolve. The first url allow me to display information or not on the website. It work fine. I identify Account&Edit for example and make action.

http://localhost/boutique/index.php?Account&Edit
$_SERVER['QUERY_STRING'] = Account&Edit

If I rewrite the url, the system does not work and Account&Edit become Account/Edit

http://localhost/boutique/index.php/Account/Edit
$_SERVER['QUERY_STRING'] = '';

How to resolve this element when this element Account&Edit change ? $_SERVER['QUERY_STRING'] is empty is this case.

Thank you.

answered question

1 Answer

9

Take a look at RFC3875: The Common Gateway Interface (CGI) Version 1.1

  • When you have no ? i nthe request URL, then there's no query string.

  • Looking at REQUEST_URI would make sense.

This is how request urls are split into environment vars:

#                                   QUERY_STRING
#                                   ????????????
http://localhost/boutique/index.php?Account&Edit

Or the part after the (directly invoked) php script. (This may vary depending on SAPI or be impacted by rewrite rules).

#                                    PATH_INFO
#                                  ?????????????
http://localhost/boutique/index.php/Account/Edit

Or the full path:

#                        REQUEST_URI
#               ????????????????????????????????
http://localhost/boutique/index.php/Account/Edit

posted this

Have an answer?

JD

Please login first before posting an answer.

Ads

Categories