Yii 1.1.11 enableHistory with SEO-friendly URLs breaks pagination

enableHistory works great with with using default ?r=controller/action, however with urlManager configured as this:

 'urlManager' => array(

        	'urlFormat' => 'path',

        	'showScriptName' => false,


Pagination does not work anymore. Filtering, including history, works as expected on Page 1. But visiting another page breaks filters, and you stay on Page 1.

When selecting a new page in CGridView, the URL is updated to:


But the page does not change. Note the questionmark in the URL which seems out of place.

Server: Apache (WAMP) on Windows 7

PHP version: 5.3.8

Browser: Firefox 14.01

Yii: 1.1.11

Please try with https://github.com/yiisoft/yii/zipball/master

Still there.

selecting multiple pages without applying filter results in url


Do you have standard rules?




No, the urlManager is configured exactly as in the first post.

Gridview is also pretty much default:


$this->widget('zii.widgets.grid.CGridView', array(

	'id' => 'content-grid',

	'dataProvider' => $model->search(),

	'enableHistory' => true,

	'filter' => $model,

	'columns' => array(



        	'name' => 'published',

        	'value' => '($data->published == 0) ? Yii::t(\'app\', \'No\') : Yii::t(\'app\', \'Yes\')',

        	'filter' => array('0' => Yii::t('app', 'No'), '1' => Yii::t('app', 'Yes')),



        	'class' => 'CButtonColumn',

        	'template' => '{delete}',





Add default rules and it should help.

I’d rather not.

I want to implement this in an existing application and I cannot gaurentee every URL has been created with the createURL function. If I change the routes, I may break parts of the application.

Why doesn’t the pagination respect the rules?

It does respect rules. The problem that rules are telling it to append parameters instead of replacing them.

Can you suggest a work-around or something to resolve this? Or the bare minimum of rules to add?

I’ve already did http://www.yiiframework.com/forum/index.php/topic/34547-yii-1111-enablehistory-with-seo-friendly-urls-breaks-pagination/page__view__findpost__p__166574

If that is the bare minimum of rules to add to make this work I will try it. Thank you for your time :)

I do think this should be reflected in the documentation somewhere.

Adding the rules does not work!

I use the gridview in a module, a module which is two levels deep. Same error. Adding the rules only fixes it for use outside of the module.

I’ll file a bug report, functionality provided by a framework should “just” work. And if it doesn’t, it should be clearly described in the documentation.

This bug has been fixed as of version 1.1.13, release candiate:

1246Bug #1584: Fixed CGridView and CListView urls when enableHistory was used with "path" urlFormat (mdomba)


Thanks mdomba! Note issue 1246 should also be closed - https://github.com/yiisoft/yii/issues/1246