Pagination Url Problem

[color="#008800"]/* softark posts this on behalf of Ankush Thakur */

/* He tried to post it 3 times, but they all resulted in a 404 not found page. */

/* The original post has a title that causes a fatal error with our bbs system */[/color]

Hello there, people! I’m a yii and web development newbie so please pardon stupid questions! Anyway, here goes. :)

I’m following the official docs, in which we have a tutorial that shows how to interact with the database. Everything works fine, except that when I used the pagination widget to go to next page, the URL changes from index.php?r=country/index to index.php?r=country%2Findex&page=2. This is confusing me: what’s causing this conversion from ‘/’ to ‘%2F’ and why? Further, if I edit the URL to index.php?r=country/index&page=2, the behavior is the same.

Perhaps this has more to do with browsers/servers (mine in Apache2 on Ubuntu), but I can’t tell. Would someone be good enough to explain?

I think because the url is encoded using urlencode() which is performed by createUrl.

(in /vendor/yiisoft/yii2/widgets/LinkPager.php function renderPageButton)

just config urlManager:




'urlManager' => [

    'enablePrettyUrl' => true,

    // 'showScriptName' => false,

    'rules' => [


    ],

]