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

3261 views php

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.

$_SERVER['QUERY_STRING'] = Account&Edit

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


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


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
#                                   ????????????

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

#                                    PATH_INFO
#                                  ?????????????

Or the full path:

#                        REQUEST_URI
#               ????????????????????????????????

posted this

Have an answer?


Please login first before posting an answer.