skip to Main Content

I use this simple rule to remove index.php from my site’s URLs :

RewriteRule ^.*$ ./index.php

So that http://example.com/index.php/user/me becomes http://example.com/user/me.

Do I need to add [R=301] to avoid ‘content duplication’ issues from an SEO point of view?

2

Answers


  1. You can add this rule to avoid that:

    RewriteCond %{THE_REQUEST}  /index.php/([^? ]*)
    RewriteRule ^ /%1 [L,R=301]
    

    It’ll redirect requests made with the /index.php in it to the one without. Then the rule that you already have will internally rewrite the index.php back in.

    Login or Signup to reply.
  2. Just include link rel=”canonical” href=”http://example.com/ on every page and enjoy :).
    Read more here https://support.google.com/webmasters/answer/139066?hl=en

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search