GridView giving wrong header url and pagination Url

Problem

When I have GridView from http://localhost/en/site/index, header show http://localhost/en/en?Country_sort=name and pagination http://localhost/en/en?Country_page=2

I read up that it is using route default to empty which will be that of current controller/action but that does not seem to be the case. Also, it does not follow the path format as specified on the config.

Anyone please help… thanks. Am I doing something wrong?

below is the setting

config.php (url rules are setup to assume the website is access with <lang>/<controller>/<action>

		'urlManager' =&gt; array(


		    //'class' =&gt; 'application.components.UrlManager',


		    'urlFormat' =&gt; 'path',


			'showScriptName' =&gt; false,


		    'rules' =&gt; array(


				'gii'=&gt;'gii',


				'gii/&lt;controller:&#092;w+&gt;'=&gt;'gii/&lt;controller&gt;',


				'gii/&lt;controller:&#092;w+&gt;/&lt;action:&#092;w+&gt;'=&gt;'gii/&lt;controller&gt;/&lt;action&gt;',


				'&lt;language:&#092;w+&gt;' =&gt; 'site/index',


				'&lt;language:&#092;w+&gt;/&lt;controller:&#092;w+&gt;' =&gt; '&lt;controller&gt;/index',


				'&lt;language:&#092;w+&gt;/page/&lt;view:(&#092;w|-)+&gt;/*' =&gt; 'page/page',


				'&lt;language:&#092;w+&gt;/&lt;controller:&#092;w+&gt;/&lt;action:(&#092;w|-)+&gt;/*' =&gt; '&lt;controller&gt;/&lt;action&gt;',


			    ),


			),

Controller extends CController (also redirect to a <lang>/<controller>/<action> if lang is not detect on the uri)

	// redirect to /&lt;language&gt;/&lt;controller&gt;/...


	// example, if a User land on http://www.localhost.com/ he will be redirected


	// to http://www.localhost.com/en/ showing him he have landed on the english site





	if(&#036;redirectToLanguagePage === true


	|| &#036;queryStringParts[1] &#33;= &#036;languageCode)


	{


	    if(empty(&#036;queryString)


		|| &#036;queryString == '/')


		{


			Yii::app()-&gt;request-&gt;redirect('/'.&#036;languageCode.'/'.Yii::app()-&gt;defaultController.'/index', true);


		}


		elseif(&#036;queryStringParts[1] &#33;= &#036;languageCode)


		{


	    	if(count(&#036;queryStringParts) &lt; 3)


			{


				Yii::app()-&gt;request-&gt;redirect('/'.&#036;languageCode.&#036;queryString.'/index', true);


			}


			else


			{


				Yii::app()-&gt;request-&gt;redirect('/'.&#036;languageCode.&#036;queryString, true);


			}


		}


	}

This is the expected behavior.

The paging and sorting options are specified as query string, I think, for SEO pourposes.

Using this notation the crawler will think that different sorting/paging of your page are always the same page, not different one.

That’s why they follow a different behavior. For avoid to show the query string to users, CGridView is able to do the request via ajax.

It is not about the string, but the url is wrong. Instead of /en/country/admin?xxx it is giving me en/en?xxx.

I am refering to the wrong controller and action.

I am not referring anything behind "?".

Please advice if how I can set the controller/action for the route for the link in header and pagination.

Seems like an old topic, but anyway the solution is to set


pagination->params=>array('param1'=>$param1,'param2'=>$param2)

.

Even if your action does not have any params, it should must be set as follows:


pagination->params=>array()

Cheers