I am using pagination on default page,i.e, on site/index in yii2. So the URL generated by linker for paginations looks like this
domain.com/site/index?page=1
I want to remove site/index and page parameter so that it looks like as follows
domain.com/1
I tried writing rule in URL manager in config file like this
'site/index/<page:\d+>' => 'site/index'
This made the url like as follows
domain.com/site/index/1
So to remove site/index as well, I set route of pagination to '/' like this
$pagination->route = '/';
This removed site/index from URL but this again changed the URL to look like
domain.com/?page=1
I tried changing rule in URL manager like this
'/<page:\d+>' =>'site/index';
But the URL remained the same. My question is how to make it look like
domain.com/1
I am using Yii2 advanced template and have enabled strict parsing in URL manager.
I got this working on my local machine using the following component configuration:
and SiteController: