I’m creating pretty pagination rules on my site using Pagination. Everything works fine, but I’m getting duplicate content according to Google.
example.com/tag/movie/2
and
example.com/tag/movie?page=2
These are two valid urls, contains same content. And my question is how to remove
?page=2
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, ]);