$_GET is not populated from URL query string in custom UrlRule

It’s really weird for me. I have created a custom “class LanguageUrlRule extends CBaseUrlRule”. It has two functions createUrl and parseUrl. The class successfully parses the following type of URLs: site/ru/ky/phrase using the following regular expression.


if (preg_match('%^site/(\w+)(/(\w+)(/(.+)(/)?)?)?$%', $pathInfo, $matches))

However, for some unknown reasons $_GET is empty when URL has ajax param like site/ru/ky/phrase?ajax=ajax. Why?

If I look into the value of $request->_requestUri, it has a correct full data like “/site/ky/ru/phrase?ajax=ajax”. So why $_GET isn’t getting populated?

I really need your help. Please.

P.S. Interesting thing is on my localhost, $_GET is populated, on production server on Amazon EC2, $_GET isn’t populated.

Any idea? This feature really halts the entire development! Any hint is highly appreciated.

I use nginx on both ends with no rewrites.

I found the problem. It was quite easy. All you need is just know the fact, but I didn’t. Once more consulted nginx configuration for Yii, and found that none of the $_GET parameters were being passed to PHP.

To correctly pass params from nginx to php, need to add ?$args like:




location / {

        try_files $uri $uri/ /index.html /index.php?$args;

}



It used to be:




location / {

        try_files $uri $uri/ /index.html /index.php;

}



I’m having the same issue, only with Apache. Any ideas how Apache’s rewrite rules handles this?

EDIT: Never mind, I extracted the args from the request uri :)

THANK YOUUUUUUUU!!!