undefined
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
    • SEO Q&A
    • Webinars, Whitepapers, & Guides
  • Blog
  • Why Moz
    • Agency Solutions
    • Enterprise Solutions
    • Small Business Solutions
    • Case Studies
    • 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.

    NEW Keyword Suggestions by Topic
    Moz Pro

    NEW Keyword Suggestions by Topic

    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.

    • SEO Q&A

      Insights & discussions from an SEO community of 500,000+.

    Unlock flexible pricing & new endpoints
    Moz API

    Unlock flexible pricing & new endpoints

    Find your plan
  • Blog
  • Why Moz
    • 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.

    • Case Studies

      Explore how Moz drives ROI with a proven track record of success.

    • 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
  • 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
20.1k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as question
Log in to reply
This topic has been deleted. Only users with question management privileges can see it.
  • eyepaq
    eyepaq last edited by Mar 2, 2011, 9:33 AM

    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 Mar 2, 2011, 2:00 PM Mar 2, 2011, 2:00 PM

      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 Mar 2, 2011, 12:50 PM Mar 2, 2011, 12:50 PM

        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 Mar 2, 2011, 12:15 PM Mar 2, 2011, 12:15 PM

          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 Mar 2, 2011, 12:08 PM Mar 2, 2011, 12:08 PM

            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 Mar 2, 2011, 2:00 PM Reply Quote 0
            • eyepaq
              eyepaq @eyepaq last edited by Mar 2, 2011, 11:55 AM Mar 2, 2011, 11:55 AM

              Thanks mate !

              More then helpful.

              1 Reply Last reply Reply Quote 0
              • StalkerB
                StalkerB @eyepaq last edited by Mar 2, 2011, 11:29 AM Mar 2, 2011, 11:29 AM

                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 Mar 2, 2011, 11:25 AM Mar 2, 2011, 11:25 AM

                  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 Mar 2, 2011, 10:27 AM Mar 2, 2011, 10:27 AM

                    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 Mar 2, 2011, 10:03 AM Mar 2, 2011, 9:47 AM

                      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 Mar 2, 2011, 9:42 AM Mar 2, 2011, 9:42 AM

                        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 Mar 2, 2011, 11:55 AM Reply Quote 1
                        • StalkerB
                          StalkerB last edited by Mar 2, 2011, 10:02 AM Mar 2, 2011, 9:39 AM

                          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 Mar 2, 2011, 12:08 PM Reply Quote 4
                          • 1 / 1
                          1 out of 12
                          • First post
                            1/12
                            Last post

                          Got a burning SEO question?

                          Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.


                          Start my free trial


                          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

                          • 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 | Nov 13, 2021, 7:29 PM | regineraab
                            0
                          • RameshNair

                            301 Redirect to external site

                            Hi guys, We have a client who is getting their website redesigned through us. They are discontinuing couple of their services which will not get featured in the new site. They are fairly well ranked for these services and my client wishes to 301 redirect these pages to an external site owned by his friend so that they benefit out of the ranking. The question is: Will my client's website's general ranking get affected due to 301 redirecting to an external site? The external site is not spammy or red-flagged by Google (at the moment, at least). Thanks in advance!
                            Ramesh Nair

                            On-Page Optimization | Jan 17, 2015, 10:02 AM | RameshNair
                            0
                          • alicaomisem

                            Multiple domains for the same business

                            My client purchased over 500 URLs for targeting various customers and ranking for different keywords. It is for the same business though. What is the best strategy to deal with this kind of approach in your opinion. They use different meta data for each of the URLs starting with brand name in meta title. Are there any other points to keep in mind when developing strategy for all those URLs. Is this  a good approach?

                            On-Page Optimization | Jul 22, 2014, 7:12 PM | alicaomisem
                            1
                          • 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 | Apr 4, 2013, 12:46 PM | semmediapvtltd
                            0
                          • MarieA

                            301 redirects from several sub-pages to one sub-page

                            Hi! I have 14 sub-pages i deleted earlier today. But ofcourse Google can still find them, and gives everyone that gives them a go a 404 error. I have come to the understading that this wil hurt the rest of my site, at least as long as Google have them indexed. These sub-pages lies in 3 different folders, and i want to redirect them to a sub-page in a folder number 4. I have already an htaccess file, but i just simply cant get it to work! It is the same file as i use for redirecting trafic from mydomain.no to www.mydomain.no, and i have tried every kind of variation i can think of with the sub-pages. Has anyone perhaps had the same problem before, or for any other reason has the solution, and can help me with how to compose the htaccess file? πŸ™‚ You have to excuse me if i'm using the wrong terms, missing something i should have seen under water while wearing a blindfold, or i am misspelling anything. I am neither very experienced with anything surrounding seo or anything else that has with internet to do, nor am i from an englishspeaking country. Hope someone here can light up my path πŸ™‚ Thats at least something you can say in norwegian...

                            On-Page Optimization | Feb 23, 2012, 5:57 PM | MarieA
                            1
                          • csmithal

                            Hyphens in Domain Name

                            I have a client who is a business broker. I have just begun working with them, and they are trying to determine the best domain name to use - they have several. business-broker-alabama.com vs businessbrokeralabama.com Which one of these has more value? I know that search engines have somewhat devalued keywords. The first one probably has a little more SEO value, but is going to be a drag in terms of marketing -- saying "business hyphen broker hyphen alabama" is going to get old for them. Thanks!

                            On-Page Optimization | Jul 20, 2012, 9:15 PM | csmithal
                            0
                          • BobGW

                            301 redirect and then keywords in URL

                            Hi, Matt Cutts says that 301 redirects, including the ones on internal pages, causes the loss of a little bit of link juice. But also, I know that keywords in the URL are very important. On our site, we've got unoptimized URLs (few keywords) in the internal pages. Is it worth doing a 301 redirect in order to optimize the URLs for each main page. 301 redirects are the only way we can do it on our premade cart For example (just an example) say our main (1 of the 4) keywords for the page is "brown shoes". I'm wondering if I should redirect something like shoes.com/shoecolors.html to shoes.com/brown-shoes.html In other words, with the loss of juice would we come out ahead? In what instances would we come out ahead?

                            On-Page Optimization | Jul 21, 2011, 7:41 PM | BobGW
                            0
                          • SangeetaC

                            Google Page Rank of my site has dropped from 4/10 to 3/10

                            Google Page rank of my website has been dropped after Panda Update. Can anyone help me out to tell me the possible reasons about the same. We have tried to make our website more lively and user friendly. We have indulged some graphics to make it more attractive. But it seems it backfired us. my site is http://www.myrealdata.com as well as Google page ranking of my Quickbooks hosting page has been dropped as well. It would be great if someone can help me out with expert suggestions.

                            On-Page Optimization | Jun 30, 2011, 8:23 AM | SangeetaC
                            1

                          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
                          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.