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. Please take a look at my canonical tag - is it written right?

    Please take a look at my canonical tag - is it written right?

    Technical SEO Issues
    7 3 101
    • 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.
    • kirupa
      kirupa last edited by

      Hi there! I just changed the preferred domain settings from http://example.com to http://www.example.com and received a recommended action from Google: "Ensure that you specify the new host as canonical in all page links or sitemaps."

      Could you please let me know if "the new host" is equal to "canonical" and if I have to include this tag into every page of my website ?

      Thank you!

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

        Hey Kirupa,

        Short answer is that you're all good. The canonical is correct.

        All the best,
        Sean

        kirupa 1 Reply Last reply Reply Quote 1
        • LoganRay
          LoganRay last edited by

          Kirupa,

          The syntax of your canonical tag is correct. However, there are a couple things you should know before you continue:

          1- When Google says "Ensure that you specify the new host as canonical in all page links or sitemaps." it means they want to to update internal links and your XML sitemaps, so it's more involved than simply updating your canonical tag. Basically anywhere your URLs are referenced should be updated to reflect your new www-canonical URL structure.

          2- You may have provided that one tag as an example, but DO NOT put that exact tag on every page of your site. Doing so would point search engines to the homepage of your site from any page they visit. Canonical tags are basically soft redirects that search engines follow, so when a bot sees a canonical tag on one page that points to another page, they leave and go to where the canonical is pointing them. Google will often de-index URLs that canonicalize to another URL, which I'm assuming you don't want 🙂

          kirupa 1 Reply Last reply Reply Quote 1
          • kirupa
            kirupa @LoganRay last edited by

            Logan,

            Thank you very much for your advise! I figured out that it is going to be much of work going from page to page and set their canonicals:) Maybe updating my .htaccess will work out? I am wondering if that (please see below) would be the right thing to put in there?

            RewriteEngine on
            rewritecond %{http_host} ^example.com [nc]
            rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc]

            Also, when I added the property (http://www.example.com) yesterday and set it as preferred domain, I was suggested to change the target country and submit a sitemap file for both http://example.com and http://www.example.com. I don't quite understand why do they want me to do that if the country and the sitemap are obviously the same?

            1 Reply Last reply Reply Quote 0
            • kirupa
              kirupa @seanginnaw last edited by

              Thank you, Sean! 🙂

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

                Unfortunately I'm not much of a coder, so I won't be able to guide you on the htaccess code piece. Regarding the Search Console items though, the tool treats every site that is setup as its own entity, which is why you need a country and XML for each. An example of why they do this because you might have different profiles for http://www.example.com/us and http://www.example.com/ca where the subfolder specifies the country. If they recycled the same info from each profile setup, the /ca site would be set to U.S. instead of Canada.

                kirupa 1 Reply Last reply Reply Quote 1
                • kirupa
                  kirupa @LoganRay last edited by

                  Thank you!

                  1 Reply Last reply Reply Quote 1
                  • 1 / 1
                  • First post
                    Last post
                  • How long does it take for canonical tags to work
                    SoulSurfer8
                    SoulSurfer8
                    0
                    5
                    697

                  • Duplicate content: using the robots meta tag in conjunction with the canonical tag?
                    Keszi
                    Keszi
                    0
                    2
                    321

                  • Please let me know if I am in a right direction with fixing rel="canonical" issue?
                    LoganRay
                    LoganRay
                    0
                    6
                    546

                  • Canonical tag problem
                    jesse-landry
                    jesse-landry
                    0
                    4
                    116

                  • Canonical Tag Here?
                    Dr-Pete
                    Dr-Pete
                    0
                    4
                    566

                  • Canonical tags
                    paulbaguley
                    paulbaguley
                    0
                    13
                    910

                  • Canonical and No Follow tags
                    dunklea
                    dunklea
                    0
                    3
                    1.1k

                  • Canonical Tag
                    Theo-NL
                    Theo-NL
                    0
                    3
                    865

                  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