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. How do I redirect index.html to the root / ?

    How do I redirect index.html to the root / ?

    Technical SEO Issues
    7 3 5.5k
    • 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.
    • NetPicks
      NetPicks last edited by

      The site I've inherited had operated on index.html at one point, and now uses index.php for the home page, which goes to the / page. The index.html was lost in migrating server hosts.

      How do I redirect the index.html to the / page? I've tried different options that keep giving ending up with the same 404 error. I tried a redirect from index.html to index.php which ended in an infinite loop. Because the index.html no longer exists in the root, should I created it and then add a redirect to it? Can I avoid this by editing the .htaccess?

      Any help is appreciated, thanks in advance!

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

        Hi Pascal,

        Try this in you htaccess

        RewriteEngine on

        RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.html\ HTTP/

        RewriteRule ^index.html$ http://YOURDOMAIN.COM/ [R=301,L]

        NetPicks 1 Reply Last reply Reply Quote 5
        • USHoleInOne
          USHoleInOne last edited by

          Pascal,
          chrwald is referring to a 301 redirect, which is safe for seo and should not result in an infinite loop. I've done this myself to redirect the .index.html to the root so that duplicate content would not appear.

          1 Reply Last reply Reply Quote 1
          • NetPicks
            NetPicks @chrwald last edited by

            I pasted the code into my .htaccess, and still receive a 404 for index.html. Must it be placed within module tags? Does the position of placement matter? Thanks for the quick reply, btw.

            chrwald NetPicks 3 Replies Last reply Reply Quote 0
            • chrwald
              chrwald @NetPicks last edited by

              Do you allready have some rewrite-rules in yout htaccess? In this case try placing it at the end of them.

              Works without any tags for me.

              1 Reply Last reply Reply Quote 0
              • NetPicks
                NetPicks @NetPicks last edited by

                I have some re-write rules for Wordpress, which are contained within <ifmodule>tags. And below those I have some redirect 301s. I placed the code after the Wordpress re-writes, and then tried to place them at the end, past the 301 redirects, and still I receive a 404 on the index.html.</ifmodule>

                Is there anything else I could be doing? Should I create a new index.html and place a redirect within there?

                1 Reply Last reply Reply Quote 0
                • chrwald
                  chrwald @NetPicks last edited by

                  The 301 should be outside the <ifmodule>. Maybe you could post the other 301 redirects and the one which isn't working here.</ifmodule>

                  Creating a new index.html and redirecting from it would give you a 302 or even a meta-redirect, which in regard to seo is not recommended.

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  • Redirect /label/ to /tags/
                    Taiger
                    Taiger
                    0
                    3
                    143

                  • Redirecting root to /default.aspx
                    RikkiD22
                    RikkiD22
                    0
                    3
                    381

                  • WordPress - How to stop both http:// and https:// pages being indexed?
                    Dr-Pete
                    Dr-Pete
                    0
                    4
                    1.9k

                  • Correct Redirect method for switching pages from .html to /pretty urls/
                    tgr0ss
                    tgr0ss
                    0
                    3
                    529

                  • Homepage/Root domain de-indexed by Google
                    KeriMorgret
                    KeriMorgret
                    0
                    6
                    1.1k

                  • Duplicate content issue index.html vs non index.html
                    KaneJamison
                    KaneJamison
                    0
                    10
                    1.7k

                  • I have a site that has both http:// and https:// versions indexed, e.g. https://www.homepage.com/ and http://www.homepage.com/. How do I de-index the https// versions without losing the link juice that is going to the https://homepage.com/ pages?
                    fthead9
                    fthead9
                    0
                    3
                    729

                  • Root vs. Index.html
                    RyanKent
                    RyanKent
                    0
                    2
                    903

                  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