The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Technical SEO Issues
    4. Rel canonical or 301 the Index Page?

    Rel canonical or 301 the Index Page?

    Technical SEO Issues
    8 5 1.4k
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • bozzie311
      bozzie311 last edited by

      Still a bit confused on best practice for /index.php showing up as duplicate for www.mysite.com. What do I need to do and How?

      1 Reply Last reply Reply Quote 0
      • Marcus_Miller
        Marcus_Miller last edited by

        Add a canonical URL of www.mysite.com to the homepage (/ & /index.php) & 301 redirect www.mysite.com/index.php to www.mysite.com

        That covers both bases and will see the content indexed on the correct page before too long.

        Cheers
        Marcus

        1 Reply Last reply Reply Quote 0
        • StalkerB
          StalkerB last edited by

          Probably the simplest way is to put this in your .htaccess file

          RewriteEngine On Options +FollowSymLinks

          RewriteCond %{HTTP_HOST} ^example.com
          RewriteRule (.*) http://www.example.com/$1 [R=301,L]

          RewriteCond %{THE_REQUEST} ^.*/index.html
          RewriteRule ^(.*)index.html$ http://www.example.com/$1 [R=301,L]

          For reference the .htaccess file goes in the root of your domain via whatever file transfer program you use and of course replace example.com with your domain 😉

          This also makes sure the non-www redirects to the www.

          If you get stuck, let me know 🙂

          bozzie311 1 Reply Last reply Reply Quote 3
          • bozzie311
            bozzie311 @StalkerB last edited by

            so just adding this in should work too right?

            redirect 301 /index.php http://www.mysite.com/

            I have this already:

            RewriteCond %{HTTP_HOST} ^mysite.com$ [NC]
            RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]

            StalkerB 1 Reply Last reply Reply Quote 0
            • StalkerB
              StalkerB @bozzie311 last edited by

              Theoretically should work; you can quickly try it to see and change it back if it doesn't work 🙂

              Doing it your way I've had sites fall over a few times (white page of death), but changing it back fixes things in no time.

              1 Reply Last reply Reply Quote 0
              • Marcus_Miller
                Marcus_Miller last edited by

                You do get small variations in how the server wants the htaccess but give it a go and see if it works.

                If you are happy it is working in the browser then there is a free bit of software called webbug that will let you see the HTTP headers to ensure you are getting the 301 permanent redirect returned.

                Hope it helps. 🙂

                1 Reply Last reply Reply Quote 1
                • CPU
                  CPU last edited by

                  I would recommend Barry's original solution as not only does it fix the issue you mentioned, it takes care of a couple of other potential duplicate content issues (slashes elsewhere and www vs non-www)

                  Marcus's solution should be fine if want to fix the one issue on the single page.mentioned.

                  1 Reply Last reply Reply Quote 0
                  • KeriMorgret
                    KeriMorgret last edited by

                    Hi! I'm following up on older questions, and wondering if you got this straightened out or still need a hand. Thanks!

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post
                    • Rel=canonical or 301 to pass on page authority/juice
                      ThompsonPaul
                      ThompsonPaul
                      0
                      6
                      101

                    • Canonical vs 301 for index.php
                      GastonRiera
                      GastonRiera
                      0
                      4
                      205

                    • Rel canonical for partner sites - product pages only or also homepage and other key pages?
                      0
                      1
                      73

                    • Moving content from CMS pages to a blog - 301 or rel canonical?
                      TakeshiYoung
                      TakeshiYoung
                      0
                      4
                      187

                    • Adding Rel Canonical to multiple pages
                      Dr-Pete
                      Dr-Pete
                      0
                      9
                      736

                    • Will rel=canonical cause a page to be indexed?
                      Dr-Pete
                      Dr-Pete
                      0
                      6
                      611

                    • If you only want your home page to rank, can you use rel="canonical" on all your other pages?
                      KeriMorgret
                      KeriMorgret
                      0
                      4
                      699

                    • How rel=canonical works with index, noindex ?
                      Everett
                      Everett
                      0
                      12
                      2.2k

                    Get started with Moz Pro!

                    Unlock the power of advanced SEO tools and data-driven insights.

                    Start my free trial
                    Products
                    • Moz Pro
                    • Moz Local
                    • Moz API
                    • Moz Data
                    • STAT
                    • Product Updates
                    Moz Solutions
                    • SMB Solutions
                    • Agency Solutions
                    • Enterprise Solutions
                    • Digital Marketers
                    Free SEO Tools
                    • Domain Authority Checker
                    • Link Explorer
                    • Keyword Explorer
                    • Competitive Research
                    • Brand Authority Checker
                    • Local Citation Checker
                    • MozBar Extension
                    • MozCast
                    Resources
                    • Blog
                    • SEO Learning Center
                    • Help Hub
                    • Beginner's Guide to SEO
                    • How-to Guides
                    • Moz Academy
                    • API Docs
                    About Moz
                    • About
                    • Team
                    • Careers
                    • Contact
                    Why Moz
                    • Case Studies
                    • Testimonials
                    Get Involved
                    • Become an Affiliate
                    • MozCon
                    • Webinars
                    • Practical Marketer Series
                    • MozPod
                    Connect with us

                    Contact the Help team

                    Join our newsletter
                    Moz logo
                    © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                    • Accessibility
                    • Terms of Use
                    • Privacy