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. Intermediate & Advanced SEO
    4. Canonical or 301 redirect, that is the question?

    Canonical or 301 redirect, that is the question?

    Intermediate & Advanced SEO
    8 5 546
    • 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.
    • bronxpad
      bronxpad last edited by

      So my site has duplicate content issues because of the index.html and the www and non www version of the site. What's the best way to deal with this without htaccess? Is it a 301 redirect or is it the canonical, or is it both?

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

        Hi Joel,

        I'd say a 301 redirect using your HTaccess file is best. However, if you cannot access the htaccess file i'd go with the rel canonical. Otherwise you would be using meta refresh or javascript and the like, which are generally not appreciated by Google. Besides, if the page is truly a duplicate the canonical link tag usually does the trick anyway!

        Good luck,

        Sven Witteveen
        Expand Online

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

          Hi Joel!

          Googles recommendation for this is a 301 redirect.

          If you need to change the URL of a page as it is shown in search engine results, we recommended that you use a server-side 301 redirect.

          More reading: http://support.google.com/webmasters/bin/answer.py?hl=en&answer=93633

          In other case, if you dont have access to do it server-side, then a canonical is better then nothing.

          Good luck!

          bronxpad 1 Reply Last reply Reply Quote 0
          • bronxpad
            bronxpad @Vivamedia last edited by

            what about using a php 301 redirect? is that also a good option? I'm looking for the simplest solution that doesn't mess up my seo efforts.

            Thank you

            1 Reply Last reply Reply Quote 0
            • X-com
              X-com last edited by

              I would say 301 redirect. e.g. in PHP you can use:

              /home.html to /

              if ($_SERVER['REQUEST_URI'] == '/home.html') {

              header('HTTP/1.1 301 Moved Permanently');

              header('Location: /');

              }

              non-www to www

              **if ($_SERVER['SERVER_NAME'] == 'example.com') **{

              header('HTTP/1.1 301 Moved Permanently');

              header('Location: www.example.com' . $_SERVER['REQUEST_URI']);

              }

              Good luck!

              bronxpad 1 Reply Last reply Reply Quote 2
              • bronxpad
                bronxpad @X-com last edited by

                Thanks for your tips.

                X-com 1 Reply Last reply Reply Quote 0
                • Dr-Pete
                  Dr-Pete last edited by

                  I'd agree that, theoretically, 301-redirects are better here, but if it's just the home-page, a canonical tag can definitely sweep up any problem duplicates. If you're getting www and non-www versions of multiple pages indexed, then you probably need 301s. I'd check the index with the site: operator and see. If you're really getting multiples of both indexed, you probably have internal linking issues (inconsistencies). Step 1 in any de-duplication is to make sure you're always linking to the same version. Same with "index.html" - link to "/" internally or the absolute URL of the site (without "index.html").

                  PHP (code-based) redirects should be fine, as long as they resolve correctly. I've used code-based headers in some other languages (like ColdFusion) and it's generally been ok. If that gets messy, though, and if it's just the home-page, the canonical tag will do in a pinch.

                  1 Reply Last reply Reply Quote 1
                  • X-com
                    X-com @bronxpad last edited by

                    No problem! I'm curious what solution you are planning to choose and of course, if it helped you rank higher.. although that sort of data will only be available in a couple of months of course.

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post
                    • A Really Specific Question about 301 Redirect Strategies
                      DonnaDuncan
                      DonnaDuncan
                      0
                      2
                      83

                    • HTTPS 301 Redirect Question
                      Brando16
                      Brando16
                      0
                      8
                      105

                    • To redirect or not to redirect, that is the question
                      CommT
                      CommT
                      0
                      5
                      126

                    • 301 or Canonical - Ecommerce Site Question
                      SylviaH
                      SylviaH
                      0
                      2
                      136

                    • How to conduct catch 301 redirects & have the separate 301 redirects for the key pages
                      BenRWoodard
                      BenRWoodard
                      0
                      2
                      288

                    • 301 redirect or rel=canonical
                      ORob
                      ORob
                      0
                      7
                      383

                    • 301 Redirect question
                      webseoservices
                      webseoservices
                      0
                      4
                      438

                    • Question about 301 redirect for trailing / ?
                      YannickVeys
                      YannickVeys
                      0
                      4
                      524

                    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