• majorAlexa

        See all notifications

        Skip to content
        Moz logo Menu open Menu close
        • Products
          • Moz Pro
          • Moz Pro Home
          • Moz Local
          • Moz Local Home
          • STAT
          • Moz API
          • Moz API Home
          • Compare SEO Products
          • Moz Data
        • Free SEO Tools
          • Domain Analysis
          • Keyword Explorer
          • Link Explorer
          • Competitive Research
          • MozBar
          • More Free SEO Tools
        • Learn SEO
          • Beginner's Guide to SEO
          • SEO Learning Center
          • Moz Academy
          • MozCon
          • Webinars, Whitepapers, & Guides
        • Blog
        • Why Moz
          • Digital Marketers
          • Agency Solutions
          • Enterprise Solutions
          • Small Business Solutions
          • The Moz Story
          • New Releases
        • Log in
        • Log out
        • Products
          • Moz Pro

            Your all-in-one suite of SEO essentials.

          • Moz Local

            Raise your local SEO visibility with complete local SEO management.

          • STAT

            SERP tracking and analytics for enterprise SEO experts.

          • Moz API

            Power your SEO with our index of over 44 trillion links.

          • Compare SEO Products

            See which Moz SEO solution best meets your business needs.

          • Moz Data

            Power your SEO strategy & AI models with custom data solutions.

          Let your business shine with Listings AI
          Moz Local

          Let your business shine with Listings AI

          Learn more
        • Free SEO Tools
          • Domain Analysis

            Get top competitive SEO metrics like DA, top pages and more.

          • Keyword Explorer

            Find traffic-driving keywords with our 1.25 billion+ keyword index.

          • Link Explorer

            Explore over 40 trillion links for powerful backlink data.

          • Competitive Research

            Uncover valuable insights on your organic search competitors.

          • MozBar

            See top SEO metrics for free as you browse the web.

          • More Free SEO Tools

            Explore all the free SEO tools Moz has to offer.

          NEW Keyword Suggestions by Topic
          Moz Pro

          NEW Keyword Suggestions by Topic

          Learn more
        • Learn SEO
          • Beginner's Guide to SEO

            The #1 most popular introduction to SEO, trusted by millions.

          • SEO Learning Center

            Broaden your knowledge with SEO resources for all skill levels.

          • On-Demand Webinars

            Learn modern SEO best practices from industry experts.

          • How-To Guides

            Step-by-step guides to search success from the authority on SEO.

          • Moz Academy

            Upskill and get certified with on-demand courses & certifications.

          • MozCon

            Save on Early Bird tickets and join us in London or New York City

          Unlock flexible pricing & new endpoints
          Moz API

          Unlock flexible pricing & new endpoints

          Find your plan
        • Blog
        • Why Moz
          • Digital Marketers

            Simplify SEO tasks to save time and grow your traffic.

          • Small Business Solutions

            Uncover insights to make smarter marketing decisions in less time.

          • Agency Solutions

            Earn & keep valuable clients with unparalleled data & insights.

          • Enterprise Solutions

            Gain a competitive edge in the ever-changing world of search.

          • The Moz Story

            Moz was the first & remains the most trusted SEO company.

          • New Releases

            Get the scoop on the latest and greatest from Moz.

          Surface actionable competitive intel
          New Feature

          Surface actionable competitive intel

          Learn More
        • Log in
          • Moz Pro
          • Moz Local
          • Moz Local Dashboard
          • Moz API
          • Moz API Dashboard
          • Moz Academy
        • Avatar
          • Moz Home
          • Notifications
          • Account & Billing
          • Manage Users
          • Community Profile
          • My Q&A
          • My Videos
          • Log Out

        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. Home
        2. SEO Tactics
        3. On-Page Optimization
        4. 301 redirect (www.domain.com/index to www.domain.com)

        Moz Q&A is closed.

        After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.

        301 redirect (www.domain.com/index to www.domain.com)

        On-Page Optimization
        3
        12
        20075
        Loading More Posts
        • Watching

          Notify me of new replies.
          Show question in unread.

        • Not Watching

          Do not notify me of new replies.
          Show question in unread if category is not ignored.

        • Ignoring

          Do not notify me of new replies.
          Do not show question in unread.

        • Oldest to Newest
        • Newest to Oldest
        • Most Votes
        Reply
        • Reply as question
        Locked
        This topic has been deleted. Only users with question management privileges can see it.
        • eyepaq
          eyepaq last edited by

          Hello,

          Please let me know what are the exact right steps in order to get rid of the duplicate content issues related with:

          www.domain.com/index.html same as www.domain.com  without creating an infinite loop.

          Do you have a step by step guide posted within seomoz including 301 redirect for non www to www for all urls and index.whatever to main domain name without going into a infinite loop ?

          btw how to you spot the loop ? is it obvious like never ending refresh of the home page ?

          thanks a lot !

          1 Reply Last reply Reply Quote 2
          • StalkerB
            StalkerB @eyepaq last edited by

            Well, I would recommend you alter the internal links to just point to the new '/' default, but in the meantime...

            I would have thought your code would have worked, but every time I try it my site falls over. It might work for you though. Give it a try but test it straight away 🙂

            I'll see if I can get a different version working on my test site for you if not 🙂

            1 Reply Last reply Reply Quote 2
            • eyepaq
              eyepaq @eyepaq last edited by

              seomoz tool is showing duplicate pages for those 3. Each of the version has at least 1 internal and even external links.

              all 3 respond in the browser with the same layout/page

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

                Hmm, maybe, I doubt the index.php is doing anything as if there's a index.html and index.php the .html takes precedence.

                Check what's in the .php file, might be easier just to delete it.

                1 Reply Last reply Reply Quote 1
                • eyepaq
                  eyepaq @StalkerB last edited by

                  Can I use a code like this ? (i've added one entry for index.php as it looks like the site has both an index.html and an index.php)

                  JourneymanBarry Smith
                  Journeyman264 mozpoints
                  6 helpful answers
                  1 SEOmoz endorsed answers

                  | Selected AnswerHelpful Answer | Barry Smith, Head of SEO at Gaming Media Marketing | about 2 hours ago |

                  Probably the simplest way to redirect the non-www to the www 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]

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

                  StalkerB eyepaq 3 Replies Last reply Reply Quote 0
                  • eyepaq
                    eyepaq @eyepaq last edited by

                    Thanks mate !

                    More then helpful.

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

                      Yeah, if it doesn't work you'll probably be faced with a blank page or you may get a 500 server error or maybe a 310. It should be obvious pretty fast 🙂

                      1 Reply Last reply Reply Quote 1
                      • eyepaq
                        eyepaq @eyepaq last edited by

                        how it will behave if the redirect is not correct ? It will be visible ? (like a never-ending refresh of the main page)

                        1 Reply Last reply Reply Quote 1
                        • Getz.pro
                          Getz.pro @eyepaq last edited by

                          I agree with Barry, but watch out for that last snippet. I've got caught when hosting companies redirect on their side. So test before walking away for more coffee : )

                          1 Reply Last reply Reply Quote 2
                          • StalkerB
                            StalkerB @eyepaq last edited by

                            The last part redirects index.html to /

                            There would only be a loop if you redirected / to index.html

                            99.9% sure this'll work for you 🙂 I'm using the exact code on a small site right now and it's working fine 🙂

                            1 Reply Last reply Reply Quote 2
                            • eyepaq
                              eyepaq @StalkerB last edited by

                              is the last part safe ? as far as the infinite loop things that some are afraid of..

                              StalkerB Getz.pro eyepaq 5 Replies Last reply Reply Quote 1
                              • StalkerB
                                StalkerB last edited by

                                Probably the simplest way to redirect the non-www to the www 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 😉

                                If you get stuck, let me know 🙂

                                eyepaq 2 Replies Last reply Reply Quote 4
                                • 1 / 1
                                • First post
                                  Last post

                                Browse Questions

                                Explore more categories

                                • Moz Tools

                                  Chat with the community about the Moz tools.

                                • SEO Tactics

                                  Discuss the SEO process with fellow marketers

                                • Community

                                  Discuss industry events, jobs, and news!

                                • Digital Marketing

                                  Chat about tactics outside of SEO

                                • Research & Trends

                                  Dive into research and trends in the search industry.

                                • Support

                                  Connect on product support and feature requests.

                                • See all categories

                                Related Questions

                                • SneakerFiles

                                  SERP Hijacking/Content Theft/ 302 Redirect?

                                  Sorry for the second post, thought this should have it's own. Here is the problem I am facing amongst many others. Let's take the search term "Air Jordan Release Dates 2017" and place it into Google Search.  Here is a link:
                                  https://www.google.com/#q=air+jordan+release+dates+2017 Towards the bottom of the page, you will see a website that has SneakerFiles (my website) in the title.  The exact title is: Air Jordan Release Dates 2016, 2017 | SneakerFiles - Osce Now, this is my content, but not my website. For some reason, Google thinks this is my site. If you click on the link in search, it automatically redirects you to another page (maybe 302 redirect), but in the cache you can see it's mine:
                                  http://webcache.googleusercontent.com/search?q=cache:qrVEUDE1t48J:www.osce.gob.pe/take_p_firm.asp%3F+&cd=8&hl=en&ct=clnk&gl=us I have blocked the websites IP, disallowed my style.css to be used so it just shows a links without the style, still nothing. I have submitted multiple google spam reports as well as feedback from search.  At times, my page will return to the search but it gets replaced by this website. I even filed a DMCA with Google, they declined it. I reached out to their Host and Domain register multiple times, never got a response. The sad part about this, it's happening for other keywords, for example if you search "KD 9 Colorways", the first result is for my website but on another domain name (my website does rank 3rd for a different Tag page). The page I worked hard on keeping up to date. I did notice this bit of javascript from the cloaked/hacked/serp hijacking website: I disabled iFrames...(think this helps) so not sure how they are doing this. Any help would be greatly appreciated. Note: I am using Wordpress if that means anything.

                                  On-Page Optimization | | SneakerFiles
                                  0
                                • K3v1n

                                  Snippet showing as domain name with apostrophe, instead of page title when searching for the domain name.

                                  Hi, We have an issue with one of our websites, with the snippet dispaying differently in Google serps when searching for the domain or the website name rather than a search term. When searching for a search term, the page title shows as expected, but when searching for the site by the domain name either with or without the tld, it shows the snippet as the domain name with an apostrophe at the end. Domain is subli.co.uk Thanks in advance for any advice!

                                  On-Page Optimization | | K3v1n
                                  0
                                • micvitale

                                  After HTTPS upgrade, should I change all internal links, or a general 301 redirect is better?

                                  I recently upgraded to https. Of course most internal links of my old posts are still http. So I set up a 301 redirect in order to make the old link works. In terms od SEO this is good or it is better to update all the internal links to https, manually? In that case can I do it in batch with a search/replace command in the phmyadmin database? any other suggested method? thank you

                                  On-Page Optimization | | micvitale
                                  0
                                • regineraab

                                  How often is your domain authority updated?

                                  I can't seem to figure out how often our domain authority is updated - it seems random, do you know typically when this happens? Thanks!

                                  On-Page Optimization | | regineraab
                                  0
                                • ScottMcPherson

                                  How long should I leave an existing web page up after a 301 redirect?

                                  I've been reading through a few of blog posts here on moz and can't seem to find the answer to these two questions: How long should I leave an existing page up after a 301 redirect? The page old page is no longer needed but has pretty high page authority. If I take the old page down—the one that I'm redirecting from—immediately after I set up the 301 redirect, will link juice still be passed to the new page? My second question is, right now, on my index.html page I have both a 301 redirect and a rel canonical tag in the head. They were both put in place to redirect and pass link equity respectively. I did this a couple years back after someone recommended that I do both just to be safe, but from what I've gathered reading the articles here on moz is that your supposed to pick one or the other depending on whether or not it's permanent. Should I remove the rel conanical tag or would it be better to just leave it be?

                                  On-Page Optimization | | ScottMcPherson
                                  0
                                • flcity15

                                  URL Domain Used in Meta Description

                                  Today I was asked if using a domain url in your meta description can have a negative impact on your website. This description includes a list of the homepage url, but directs visitors to a different internal page of the website. My concern fell with directing visitors to a different page of the site, but promoting the homepage in the description/snippet. With Penguin 2.1 release on the 4th, I'm very cautious of my links/urls. What are your thoughts behind this? What are the possible, if any negative impacts this could have on a site? This URL does have a brand name as so the Title.

                                  On-Page Optimization | | flcity15
                                  0
                                • semmediapvtltd

                                  Is .PW domain is good for SEO?

                                  I want to register .PW domain which has recently got live to register. I am in doubt should it is good for SEO or not.

                                  On-Page Optimization | | semmediapvtltd
                                  0
                                • truckguy77

                                  Blog.mysite.com or mysite.com/blog?

                                  Hi, I'm just curious what the majority think of what's the best way to start a blog on your website for SEO benefits. Is it better to have it under a sub domain or a directory? Or does it even matter?

                                  On-Page Optimization | | truckguy77
                                  0

                                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 - 2025 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                                • Accessibility
                                • Terms of Use
                                • Privacy

                                Looks like your connection to Moz was lost, please wait while we try to reconnect.