How to get rid of of page parameter in url

I’m creating pretty pagination rules on my site using Pagination. Everything works fine, but I’m getting duplicate content according to Google.


These are two valid urls, contains same content. And my question is how to remove


parameter. In other words, I want the second URL is not to be accessible.

Here is my urlManager configs:

'rules' => [

'/' => 'site/index',

'tag/<slug:[a-zA-Z0-9-]+>/<page:\d+>' => 'site/tag-view',

'tag/<slug:[a-zA-Z0-9-]+>' => 'site/tag-view',

'<controller:\w+>/<action:\w+>' => '<controller>/action>',


And Pagination settings:

 $pages = new Pagination(['totalCount' => $countQuery->count(),'defaultPageSize' => 5,  'forcePageParam' => false, ]);

Enable strict rule parsing.