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. Rel="canonical" and rewrite

    Rel="canonical" and rewrite

    Technical SEO Issues
    4 3 551
    • 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.
    • webtarget
      webtarget last edited by

      Hi,

      I'm going to describe a scenario on one of my sites, I was wondering if someone could tell me what is the correct use of rel="canonical" here.

      Suppose I have a rewrite rule that has a rule like this:

      RewriteRule ^Online-Games /main/index.php

      So, in the index file, do I set the rel="canonical" to Online-Games or /main/index.php?

      Thanks.

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

        None of the above. If you have a .htaccess file, you need to 301 /main/index.php to OnlineGames. Another option is to tell index.php it can only be called as OnlineGames, or 301 to that directory. The reason is you're pretending that index.php is a directory. You don't want to waste the time of bots crawling the same page twice so just 301 it. You remove the issue entirely and save your crawl budget.

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

          Your example is not a case where you would use canonical links.

          Canonical links are useful when you have several pages which are accessible vial individual URLs and do not redirect to a single page, yet they have very similar content.

          A great example is a category page in an online store. Quite often, you will find various sorting methods, like price, popularity, etc. These various sorting methods usually add a parameter to the URL, something like "order=price". Yet, the content remains largely the same.

          In cases such as above, the different pages should have a canonical reference to the main page.

          In your case, you simply need a 301 redirect, that's all.

          webtarget 1 Reply Last reply Reply Quote 2
          • webtarget
            webtarget @marcinlejman last edited by

            Great, thanks a lot!

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            • Does rel="canonical" support protocol relative URL?
              Cyrus-Shepard
              Cyrus-Shepard
              0
              3
              1.9k

            • Rel="canonical" in hyperlink
              Dr-Pete
              Dr-Pete
              0
              6
              140

            • Magento Dublicate Content (Noindex and Rel"canonical")
              TogetherCare
              TogetherCare
              0
              3
              414

            • Meta data & xml sitemaps for mobile sites when using rel="canonical"/rel="alternate" annotations
              Dr-Pete
              Dr-Pete
              0
              2
              714

            • Implementation of rel="next" & rel="prev"
              KeriMorgret
              KeriMorgret
              0
              8
              1.4k

            • Rel="canonical"
              cufflinksman
              cufflinksman
              0
              4
              117

            • Choosing the right page for rel="canonical"
              jfmonfette
              jfmonfette
              0
              3
              118

            • Rel="canonical" for PFDs?
              RyanKent
              RyanKent
              0
              4
              729

            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