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?

2
  • Unless something is linking to those page numbers, it shouldn't be a problem. Commented Jan 23, 2019 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
    Commented Jan 23, 2019 at 22:30

1 Answer 1

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]
1
  • No need to escape the slash in Apache regex (since there is no slash delimiter, the slash has no special meaning).
    – MrWhite
    Commented Jan 26, 2019 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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