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

    Track AI Overviews in Keyword Research
    Moz Pro

    Track AI Overviews in Keyword Research

    Try it free!
  • 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
  • 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. Correct .htaccess settings for canonical url?

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.

Correct .htaccess settings for canonical url?

On-Page Optimization
2
5
853
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.
  • webbutler13
    webbutler13 last edited by Jan 21, 2014, 4:33 PM

    I want to forward all urls to http:www.mysite.com but am a little confuse because I am getting duplicate content error:

    Pages with Duplicate Page Content

    as of Jan 15http://titanappliancerepair.com/ 1 duplicatehttp://titanappliancerepair.com 1 duplicatehttp://titanappliancerepair.com/index.html 1 duplicate*****************************************************************What should I put ion htaccess file so I can forwardhttp://titanappliancerepair.com/index.htmlhttp://titanappliancerepair.comhttp://titanappliancerepair.com/to  http://www.titanappliancerepair.comor what is the correct way to do it?I'm confused because when I enter http://titanappliancerepair.com/ in browser it showshttp://titanappliancerepair.com so how can it be considered duplicate content?.Can someone help?I have godaddy and they have gave me this code to put RewriteEngine on
    rewritecond %{http_host} ^coolexample.com [nc]
    rewriterule ^(.
    )$ http://www.coolexample.com/$1 [r=301,nc]What is correct?

    1 Reply Last reply Reply Quote 0
    • MickEdwards
      MickEdwards @webbutler13 last edited by Jan 21, 2014, 6:21 PM Jan 21, 2014, 6:21 PM

      your directories have duplication.  For example: http://www.titanappliancerepair.com/about-us.html and http://www.titanappliancerepair.com/about-us

      You may also need   RewriteRule ^(.*).html$ /$1 [R=301**,**L]

      1 Reply Last reply Reply Quote 1
      • webbutler13
        webbutler13 last edited by Jan 21, 2014, 4:53 PM Jan 21, 2014, 4:53 PM

        Ok I have added this to htaccess file and everything seems to be redirecting in browser ok but is it good enough for google?

        Can someone check and tell me if it is correct , if not can you help with code? Thanks in advance!

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

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

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

        RewriteEngine on
        RewriteBase /

        redirect html pages to the root domain

        rewriterule ^index.html$ / [r=301,nc]

        MickEdwards 1 Reply Last reply Jan 21, 2014, 6:21 PM Reply Quote 0
        • MickEdwards
          MickEdwards last edited by Jan 21, 2014, 4:42 PM Jan 21, 2014, 4:42 PM

          It looks like you are redirecting any URL back to itself.

          You want something like this which will remove index.html and enforce a trailing slash-

          RewriteRule ^(.*)/index.html$ /$1/ [R=301,L]

          1 Reply Last reply Reply Quote 1
          • webbutler13
            webbutler13 last edited by Jan 21, 2014, 4:42 PM Jan 21, 2014, 4:42 PM

            This is what I have so far in htaccess file

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

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

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

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

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            1 out of 5
            • First post
              1/5
              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

            • AslanBarselinov

              Correct robots.txt for WordPress

              Hi. So I recently launched a website on WordPress (1 main page and 5 internal pages). The main page got indexed right off the bat, while other pages seem to be blocked by robots.txt. Would you please look at my robots file and tell me what‘s wrong? I wanted to block the contact page, plugin elements, users’ comments (I got a discussion space on every page of my website) and website search section (to prevent duplicate pages from appearing in google search results). Looks like one of the lines is blocking every page after ”/“ from indexing, even though everything seems right. Thank you so much. FzSQkqB.jpg

              On-Page Optimization | Jun 24, 2019, 1:36 AM | AslanBarselinov
              1
            • Gavo

              Meta title not showing up correctly on SERP

              We have an issue with some clients on a Wordpress CMS where title tags implemented on a Yoast SEO plugin for the Homepage are not coming up as we'd implemented them. However, the source code shows we'd implemented them correctly according to what we'd wanted.**For example, this is the title tag we implemented in the CMS:Towing Services Alberta | Jack's TowingSource code shows:Towing Services Alberta | Jack's TowingHowever, SERP results shows:**Jack's Towing | Towing Services Alberta This is not an issue with the rest of the other pages and there isn't a global template for our client's sites. It's perplexing that it's only happening on the Homepage and this is across for 3 of our clients' sites.Even more perplexing, recently we've noticed that SERP is only showing the client's business name as the title tag and this is across for 2 out of the 3 clients we'd mentioned above. Nothing has changed in the back-end.Would appreciate some insight on this issue!

              On-Page Optimization | Oct 21, 2023, 7:44 PM | Gavo
              4
            • adrecom

              Are the prepositions and separate letters in URL bad for website optimization?

              Is it ok for website optimization to use prepositions and separate letters in URL ? Examples: -i-series ; -salad-with-avocado etc.

              On-Page Optimization | Sep 9, 2016, 11:37 AM | adrecom
              0
            • doctecs

              Link flow for multiple links to same URL

              Hi there,
              my question is as follows: How does Google handle link flow if two links in a given page point to the same URL? (do they flow link individually or not?) This seems to be a newbie question, but actually it seems that there is little evidence and even also little consensus in the SEO community about this detail. Answers should include source Information about the current state of art at Google is preferable The question is not about anchor text, general best practises for linking, "PageRank is dead" etc. We do know that the "historical" PageRank was implemented (a long time ago) without special handling for multiple links, as e.g. last stated by Matt Cutts in this video: http://searchengineland.com/googles-matt-cutts-one-page-two-links-page-counted-first-link-192718 On the other hand, many people from the SEO community say that only the first link counts. But so far I could not find any data to back this up, which is quite surprising.

              On-Page Optimization | Mar 31, 2016, 6:06 AM | doctecs
              0
            • Luciana_BAH

              Duplicate URL's in Sitemap? Is that a problem?

              I submitted a sitemap to on Search Console - but noticed that there are duplicate URLs, is that a problem for Google?

              On-Page Optimization | Mar 7, 2016, 8:59 PM | Luciana_BAH
              0
            • BruceA

              How to 301 redirect, without access to .htaccess and to a new domain

              There are few ways to do this and I would like to ask other Mozzers if they have found the best way. We have a site .co.uk and are moving it back to .com.  However we do not have any access to the site folders for .co.uk.  (We have to move it anyway as our provider is withdrawing their service). We have built our URL 301 redirect file and it is ready to go, but how to impliment it? We can repoint .co.uk to another site, and then redirect all traffic for each URL but this is quite messy, or just forget trying to 301 each page and just rediect the whole site.
              the .com has more authority already, but we ready do not want to frustrate visitors who are using a link to reach a product, only to find they hit our homepage and not the product. Your thoughts would be very welcome or other ideas Bruce

              On-Page Optimization | Jun 24, 2015, 11:08 AM | BruceA
              0
            • ostiguyj

              No Data Available for this URL

              Hi, 
              I really don't understand why I have this message "No data available for this URL"
              in my SEOMOZ campain. (www.bienchezsoi.ca) When I look at my page rank, I get a score of 0 I have no idea of to fix it. Please help. Thanks

              On-Page Optimization | Dec 23, 2011, 6:19 PM | ostiguyj
              0
            • CommercePundit

              How to Define Best URL Structure for Product Pages?

              I am working on my website to edit structure with help of Google's search engine optimization starter guide. There is really good instruction to define URL structure which help us to perform well over Google's organic search. I have resolved issues regarding category pages but, I have confusion to define best URL structure for product pages. My website's product page URL structure is as follow. http://www.vistastores.com/marketumbrellas-californiaumbrella-slpt758-f13-red.html http://www.vistastores.com/homefurniture-winsomewood-93630.html URL structure is constructed with following terms. 1. Root Category Name (Market Umbrellas or Home Furniture or ....) 2. Brand Name 3. Manufacturer Part Number I am not happy with this structure and also not performing well over Google's organic search. I am thinking to include product name or title tag in URL after root domain. But, it may create very long URL and create issues in organic search display. Does it really matter to perform well over Google's organic search? How can I define best URL structure for product pages?

              On-Page Optimization | Jul 2, 2012, 8:36 AM | CommercePundit
              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.