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. Web Design
    4. Do I need to 301 redirect www.domain.com/index.html to www.domain.com/ ?

    Do I need to 301 redirect www.domain.com/index.html to www.domain.com/ ?

    Web Design
    5 5 5.0k
    • 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.
    • Small_Business_SEO
      Small_Business_SEO last edited by

      So, interestingly enough, the Moz crawler picked up my index.html file (homepage) and reported duplicate content, of course. But, Google hasn't seemed to index the www.domain.com/index.html version of my homepage, just the www.domain.com version. However, it looks like I do have links going specifically to www.domain.com/index.html and I want to make sure those are getting counted towards my overall domain strength.

      Is it necessary to 301 redirect in the scenario described above?

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

        Yes, you will want to redirect it. Be careful though as a lot of times this isn't done correctly and creates a loop. There are multiple ways to do this including but not limited to DirectoryIndex or a RewriteRule

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

          Yep,

          This code inside your .htaccess file should fix that.

          ``RewriteEngine On 
          RewriteBase /` RewriteRule ^(.*)index\.(html|php)$ http://%{HTTP_HOST}/$1 [R=301,L]`
          
          Hope it helps,
          Don
          
          1 Reply Last reply Reply Quote 2
          • MindlessWizard
            MindlessWizard last edited by

            I would recommend you to do that.  Homepage may have different versions  depending on the CMS you are using.

            index.htm index.html

            index.php

            So as @donford mentioned you can fix that with .htaccess

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

              Hi,

              I tested the code mentioned above:

              RewriteEngine On
              RewriteBase /
              RewriteRule ^(.*)index.(html|php)$ http://%{HTTP_HOST}/$1 [R=301,L]

              It works well for index.php, but not for XX-index.php. The site where I tested this code is bilingual, so there is also a GR-index.php file and the above code redirects it to the root domain as well.

              Also, another problem is that the code above causes the redirection of index.php inside any directory. For example, http://domain.com/directory/index.php is redirected to http://domain.com/directory/

              How can I avoid this and keep only a "basic" redirection of http://domain.com/index.php to http://domain.com?

              Yannis

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              • Directing a domain.com/BLOG to a different host
                Christy-Correll
                Christy-Correll
                0
                3
                44

              • I have a site that has a 302 redirect loop on the home page (www.oncologynurseadvisor.com) i
                DmitriiK
                DmitriiK
                0
                4
                219

              • 302 redirects, canonicalise or redirect (301)?
                eLab_London
                eLab_London
                0
                5
                754

              • HTTPS redirecting to subdomain; do I need to 301 to HTTP first?
                alimo
                alimo
                0
                5
                346

              • Blog.yoursite.com or yoursite.com/blog/?
                Francisco_Meza
                Francisco_Meza
                0
                4
                607

              • Duplicate home page /index.asp /index.php etc
                William.Lau
                William.Lau
                0
                4
                666

              • Is it OK to 301 Redirect http://homepage.com to http://blog.homepage.com?
                SimonCullum
                SimonCullum
                0
                4
                601

              • SEOMoz crawl report shows a duplicate content and duplicate title for these two url's http://freightmonster.com/ and http://freightmonster.com/index.html. How do I fix this?
                Smith-Digital
                Smith-Digital
                1
                3
                610

              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