1

My blog is creating duplicate pagination, and Google understands this as duplicate content. How to 301 redirect pagination as in the following examples?

  • https://example.com/page/33?page=34 to: https://example.com/page/33
  • https://example.com/page/23?page=25 to: https://example.com/page/23

I need redirect all ?page= to your correct link /number

Recently, I was able to remove broken links ?m=0 with:

RewriteCond %{QUERY_STRING} ^m=[01]$
RewriteRule (.*) /$1? [R=301,L]
0

This should do it:

RewriteCond %{QUERY_STRING} ^page=[0-9]+$
RewriteRule ^/?(page/[0-9]+)$ /$1? [R=301,L]

When the query string has a page number in it like page=34 and the path is also a page number like /page/23, then redirect to remove the query string.

  • [0-9]+ is one or more digits, ie a number
  • ^ and $ are "starts with" and "ends with" respectively, the query string will only match if the page parameter is the only thing in it.
  • ^/? is starts with an optional slash so that this rule can work in .htaccess or in apache conf files.
  • () are capturing parenthesis whose contents are then available in $1
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.