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' => array(
//'class' => 'application.components.UrlManager',
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => array(
'gii'=>'gii',
'gii/<controller:\w+>'=>'gii/<controller>',
'gii/<controller:\w+>/<action:\w+>'=>'gii/<controller>/<action>',
'<language:\w+>' => 'site/index',
'<language:\w+>/<controller:\w+>' => '<controller>/index',
'<language:\w+>/page/<view:(\w|-)+>/*' => 'page/page',
'<language:\w+>/<controller:\w+>/<action:(\w|-)+>/*' => '<controller>/<action>',
),
),
…
Controller extends CController (also redirect to a <lang>/<controller>/<action> if lang is not detect on the uri)
…
// redirect to /<language>/<controller>/...
// 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($redirectToLanguagePage === true
|| $queryStringParts[1] != $languageCode)
{
if(empty($queryString)
|| $queryString == '/')
{
Yii::app()->request->redirect('/'.$languageCode.'/'.Yii::app()->defaultController.'/index', true);
}
elseif($queryStringParts[1] != $languageCode)
{
if(count($queryStringParts) < 3)
{
Yii::app()->request->redirect('/'.$languageCode.$queryString.'/index', true);
}
else
{
Yii::app()->request->redirect('/'.$languageCode.$queryString, true);
}
}
}