2

My problem is that my homepage exists on https://www.example.com/page/2/, /3/, /4/ and so on, it still exists on /1000/. Same duplicate page versions exists on /about and and /contact page of my site.

Now what I want is to redirect all the https://www.example.com/page/* URLs to https://www.example.com

What code should I use on .htaccess to fix these duplicate page versions of my website?

  • Unless something is linking to those page numbers, it shouldn't be a problem. – Stephen Ostermiller Jan 23 at 21:25
  • To clarify, https://www.example.com/ does currently display your homepage and this is the URL that you are linking to throughout your site? – MrWhite Jan 23 at 22:30
2

rule for all after /page/* redirecting to homepage:

RewriteEngine On
RewriteRule ^page\/(.*)$ / [R=301,L]

or all /page/0-9+/ redirecting to homepage:

RewriteEngine On
RewriteRule ^page\/(\d+)\/$ / [R=301,L]
  • No need to escape the slash in Apache regex (since there is no slash delimiter, the slash has no special meaning). – MrWhite Jan 26 at 9:27

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.