Yii2 how to use pagination createurl

How can I use the default yii2 pagination widget to change the URL

From http://example.com/blog/index?page=2&per-page=10

To http://example.com/blog/page/2

I have the following code in my URL manager so you can access it I just need the href to change in my listview pager


'blog/page/<page:\d+>' => 'blog/index',

You have to add per-page in rule as well.

Okay thanks but adding per page wont change my pagination URLs will it?

Every url matching the rule will change so as long as the pagination links look like that these will change too.

If you don’t allow to change page size you can skip this per-page param by adding forcePageParam => false, pageSizeLimit => false and defaultPageSize => X in your pagination object.