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.

    • 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
    • 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. Intermediate & Advanced SEO
  4. How do I get rel='canonical' to eliminate the trailing slash on my home page??

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.

How do I get rel='canonical' to eliminate the trailing slash on my home page??

Intermediate & Advanced SEO
3
8
5.3k
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.
  • Dillman
    Dillman last edited by Mar 15, 2014, 8:48 PM

    I have been searching high and low. Please help if you can, and thank you if you spend the time reading this. I think this issue may be affecting most pages.

    SUMMARY: I want to eliminate the trailing slash that is appended to my website.

    SPECIFIC ISSUE: I want www.threewaystoharems.com to showing up to users and search engines without the trailing slash but try as I might it shows up like www.threewaystoharems.com/ which is the canonical link.

    WHY?  and I'm concerned my back-links to the link without the trailing slash will not be recognized but most people are going to backlink me without a trailing slash. I don't want to loose linkjuice from the people and the search engines not being in consensus about what my page address is.

    THINGS I"VE TRIED:

    (1) I've gone in my wordpress settings under permalinks and tried to specify no trailing slash. I can do this here but not for the home page.

    (2) I've tried using the SEO by yoast to set the canonical page. This would work if I had a static front page, but my front page is of blog posts and so there is no advanced page settings to set the canonical tag.

    (3) I'd like to just find the source code of the home page, but because it is CSS, I don't know where to find the reference.  I have gone into the css files of my wordpress theme looking in header and index and everywhere else looking for a specification of what the canonical page is. I am not able to find it. I'm thinking it is actually specified in the .htaccess file.

    (4) Went into cpanel file manager looking for files that contain Canonical. I only found a file called canonical.php . the only thing that seemed like it was worth changing was changing line 139 from $redirect_url = home_url('/');  to $redirect_url = home_url('');       nothing happened. I'm thinking it is actually specified in the .htaccess file.

    (5) I have gone through the .htaccess file and put thes 4 lines at the top (didn't redirect or create the proper canonical link) and then at the bottom of the file  (also didn't redirect or create the proper canonical link) :   RewriteEngine on
    RewriteCond %{HTTP_HOST} ^([a-z.]+)?threewaystoharems.com$ [NC]
    RewriteCond %{HTTP_HOST} !^www. [NC]
    RewriteRule .? http://www.%1threewaystoharems.com%{REQUEST_URI} [R=301,L]

    Please help friends.

    1 Reply Last reply Reply Quote 0
    • AlanMosley
      AlanMosley last edited by Mar 16, 2014, 11:00 PM Mar 16, 2014, 11:00 PM

      Having a canonical link pointing to that same url as in the address bar has no affect as far as search engines are concern, the reason moz.com gives for doing this is that if some one scrapes your site, the canonical will point back to the original.

      The whole idea of canonical tags and 301's is to do with requests, you want the all requests showing the same content to appear the same page to the search engine.

      With normal pages a slash means a different request that without, and to fix it you need to create a 301 that requests again to the correct url. in the process you have lost a bit of link juice.

      but when requesting the home page with or without the "/", the request is the same. there is no need to fix it.

      press F12 in your browser and test it yourself using the network tab, you can see that entering the url with or without the "/" on the homepage results in the same request.

      1 Reply Last reply Reply Quote 0
      • Dillman
        Dillman @AlanMosley last edited by Mar 16, 2014, 5:51 PM Mar 16, 2014, 5:51 PM

        Thank you for your response Alan.

        If what you say is true why wouldn't google webmaster tools specifically say that in their article on Canonical links? and why would high pr sites like moz.com feel the need to specify the correct link with a canonical link on their homepage. Just because the browsers read the homepage as the same does not suggest to me that it does not matter if one specifies which is the correct one. The question at hand is not whether it can be read but whether it can be back-linked to properly.

        1 Reply Last reply Reply Quote 0
        • AlanMosley
          AlanMosley last edited by Mar 16, 2014, 10:43 AM Mar 16, 2014, 10:43 AM

          If you have a trailing slash, on a url like domain.com/mypage/ then that is a different url to domain.com/mypage

          If you fix this with a 301 you lose a bit of link juice in the redirect.

          but if you are talking about a homepage url such as domain.com and domain.com/ these are not treated as different urls, there is no redirect between them. there is no problem here, don't worry about it

          Dillman 1 Reply Last reply Mar 16, 2014, 5:51 PM Reply Quote 0
          • Dillman
            Dillman last edited by Mar 16, 2014, 6:04 AM Mar 16, 2014, 6:04 AM

            Philip,

            You are the man. That totally worked.

            I do believe that google is smart enough to see them as the same, I also think it would make sense that they are trying to weed out most people that don't know what they are doing by giving priority rank to websites that backlinks that are consistent with their canonical specification. They say in their support articles that they see the trailing slash and no trailing slash sites as 2 separate sites and that webmasters will be spreading their link juice if they don't specify which one to use. It seems to logically follow that if your web users are linking to the "wrong" page, google is not going to give priority because it signifies that the developer is not properly branding his site and/or hasn't created the user experience to cause it to happen properly. Here are 2 sources where google talks about their stance on canonical links: https://support.google.com/webmasters/answer/139066?hl=en and https://support.google.com/webmasters/answer/139394?hl=en&ref_topic=2371375 . I'd like to hear any more thoughts on my hypothesis.

            1 Reply Last reply Reply Quote 0
            • Philip-DiPatrizio
              Philip-DiPatrizio last edited by Mar 16, 2014, 5:47 AM Mar 16, 2014, 4:54 AM

              Dillon,

              Thanks for the additional explanation.  I do see the canonical tag in your code and see that it is being placed by Yoast's WordPress SEO plugin.

              Honestly, you should not worry about the trailing slash.  Google and Bing are intelligent enough to understand that .com and .com/ are the same website.  You are receiving credit for your backlinks regardless of whether or not the trailing slash exists on the link.

              Having said that, here's how you can remove the trailing slash if you still really want to.....

              Login to your WordPress backend as an administrator and look for "Plugins" on the left menu and go to "Editor" within the plugins menu.  From there, find the dropdown menu near the top right and go to "WordPress SEO".  On the list of files that display on the right side, find "wordpress-seo/frontend/class-frontend.php".

              In that file, use CTRL + F to find this line of code: $canonical = home_url( '/' );

              Remove the / within the ' '

              Click on "Update File".  Refresh your homepage and you will see that the trailing slash is gone from the canonical tag.  Keep in mind, this is a hack.  When you update WordPress SEO, this will most likely be overwritten and you'll have to do it again.

              1 Reply Last reply Reply Quote 1
              • Dillman
                Dillman last edited by Mar 16, 2014, 4:29 AM Mar 16, 2014, 4:29 AM

                Hi Philip,

                Thank you for your response. I am definitely obsessing, although I'm pretty sure it is not over nothing, and, I would be happy to be proven wrong (it would save me some time) lol.

                It is my understanding that a lot of browsers, like Chrome, will remove the slash from their url but just in the graphical user interface because it looks better, while in fact they reading it with the trailing slash at the end. Browser SEAMONKEY does accurately show the trailing slash. The real way to know from the coding is that the page source still shows <link rel="<a class="attribute-value">canonical</a>" href="http://www.threewaystoharems.com/" /> , when I really want it to show as <link rel="<a class="attribute-value">canonical</a>" href="http://www.threewaystoharems.com" /> (trailing slash omitted). If I were to speculate on what is really going on behind the scenes, is that google knows that most websites are going to default to using a trailing slash and most users are going to link without the trailing slash. It seems to me that google is trying to separate the SEO professionals from the amateurs by seeing these as two different sites and making the professionals have to figure out how to get the trailing slash off of their home pages in order to get their backlinks. If you notice, moz.com 's page source shows no trailing slash on their link rel="canonical" .

                Am I crazy? I'm pretty sure I need to figure this out to get my backlinks to link properly.

                1 Reply Last reply Reply Quote 0
                • Philip-DiPatrizio
                  Philip-DiPatrizio last edited by Mar 15, 2014, 10:17 PM Mar 15, 2014, 10:17 PM

                  Where are you seeing the trailing slash?  If I go to threewaystoharems.com in my browser, there is no trailing slash.  I do see a trailing slash if I do a Google search for "site:threewaystoharems.com" but that is normal.  Every website will show that trailing slash.

                  I think you might be obsessing over a non-issue 🙂  Let me know if i am misunderstanding.

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

                  • ostesmorbrod

                    Landing pages for paid traffic and the use of noindex vs canonical

                    A client of mine has a lot of differentiated landing pages with only a few changes on each, but with the same intent and goal as the generic version. The generic version of the landing page  is included in navigation, sitemap and is indexed on Google. The purpose of the differentiated landing pages is to include the city and some minor changes in the text/imagery to best fit the Adwords text. Other than that, the intent and purpose of the pages are the same as the main / generic page. They are not to be indexed, nor am I trying to have hidden pages linking to the generic and indexed one (I'm not going the blackhat way). So – I want to avoid that the duplicate landing pages are being indexed (obviously), but I'm not sure if I should use noindex (nofollow as well?) or rel=canonical, since these landing pages are localized campaign versions of the generic page with more or less only paid traffic to them. I don't want to be accidentally penalized, but I still need the generic / main page to rank as high as possible... What would be your recommendation on this issue?

                    Intermediate & Advanced SEO | Sep 7, 2017, 7:34 AM | ostesmorbrod
                    0
                  • Solid_Gold

                    Why is rel="canonical" pointing at a URL with parameters bad?

                    Context Our website has a large number of crawl issues stemming from duplicate page content (source: Moz). According to an SEO firm which recently audited our website, some amount of these crawl issues are due to URL parameter usage. They have recommended that we "make sure every page has a Rel Canonical tag that points to the non-parameter version of that URL…parameters should never appear in Canonical tags." Here's an example URL where we have parameters in our canonical tag... http://www.chasing-fireflies.com/costumes-dress-up/womens-costumes/ rel="canonical" href="http://www.chasing-fireflies.com/costumes-dress-up/womens-costumes/?pageSize=0&pageSizeBottom=0" /> Our website runs on IBM WebSphere v 7. Questions Why it is important that the rel canonical tag points to a non-parameter URL? What is the extent of the negative impact from having rel canonicals pointing to URLs including parameters? Any advice for correcting this? Thanks for any help!

                    Intermediate & Advanced SEO | Jan 22, 2016, 3:35 PM | Solid_Gold
                    1
                  • Modi

                    After Server Migration - Crawling Gets slow and Dynamic Pages wherein Content changes are not getting Updated

                    Hello, I have just performed doing server migration 2 days back All's well with traffic moved to new servers But somehow - it seems that w.r.t previous host that on submitting a new article - it was getting indexed in minutes. Now even after submitting page for indexing - its taking bit of time in coming to Search Engines and some pages wherein content is daily updated - despite submitting for indexing - changes are not getting reflected Site name is - http://www.mycarhelpline.com Have checked in robots, meta tags, url structure - all remains well intact. No unknown errors reports through Google webmaster Could someone advise - is it normal - due to name server and ip address change and expect to correct it automatically or am i missing something Kindly advise in . Thanks

                    Intermediate & Advanced SEO | Jun 20, 2015, 12:50 PM | Modi
                    0
                  • 94501

                    How can I get a list of every url of a site in Google's index?

                    I work on a site that has almost 20,000 urls in its site map. Google WMT claims 28,000 indexed and a search on Google shows 33,000. I'd like to find what the difference is. Is there a way to get an excel sheet with every url Google has indexed for a site? Thanks... Mike

                    Intermediate & Advanced SEO | Oct 10, 2014, 3:35 AM | 94501
                    0
                  • AlliedComputer

                    Rel="canonical" and rel="alternate" both necessary?

                    We are fighting some duplicate content issues across multiple domains. We have a few magento stores that have different country codes. For example: domain.com and domain.ca, domain.com is the "main" domain. We have set up different rel="alternative codes like: The question is, do we need to add custom rel="canonical" tags to domain.ca that points to domain.com? For example for domain.ca/product.html to point to: Also how far does rel="canonical" follow?  For example if we have:
                    domain.ca/sub/product.html canonical to domain.com/sub/product.html
                    then,
                    domain.com/sub/product.html canonical to domain.com/product.html

                    Intermediate & Advanced SEO | Sep 9, 2013, 6:32 PM | AlliedComputer
                    0
                  • WEB-IRS

                    Include Cross Domain Canonical URL's in Sitemap - Yes or No?

                    I have several sites that have cross domain canonical tags setup on similar pages.  I am unsure if these pages that are canonicalized to a different domain should be included in the sitemap.  My first thought is no, because I should only include pages in the sitemap that I want indexed. On the other hand, if I include ALL pages on my site in the sitemap, once Google gets to a page that has a cross domain canonical tag, I'm assuming it will just note that and determine if the canonicalized page is the better version.  I have yet to see any errors in GWT about this.   I have seen errors where I included a 301 redirect in my sitemap file.  I suspect its ok, but to me, it seems that Google would rather not find these URL's in a sitemap, have to crawl them time and time again to determine if they are the best page, even though I'm indicating that this page has a similar page that I'd rather have indexed.

                    Intermediate & Advanced SEO | Jul 6, 2012, 5:24 PM | WEB-IRS
                    0
                  • Jellyfish-Agency

                    Rel=canonical tag on original page?

                    Afternoon All,
                    We are using Concrete5 as our CMS system, we are due to change but for the moment we have to play with what we have got. Part of the C5 system allows us to attribute our main page into other categories, via a page alaiser add-on. But what it also does is create several url paths and duplicate pages depending on how many times we take the original page and reference it in other categories. We have tried C5 canonical/SEO add-on's but they all seem to fall short. We have tried to address this issue in the most efficient way possible by using the rel=canonical tag. The only issue is the limitations of our cms system. We add the canonical tag to the original page header and this will automatically place this tag on all the duplicate pages and in turn fix the problem of duplicate content. The only problem is the canonical tag is on the original page as well, but it is referencing itself, effectively creating a tagging circle. Does anyone foresee a problem with the canonical tag being on the original page but in turn referencing itself? What we have done is try to simplify our duplicate content issues. We have over 2500 duplicate page issues because of this aliasing add-on and want to automate the canonical tag addition, rather than go to each individual page and manually add this tag, so the original reference page can remain the original. We have implemented this tag on one page at the moment with 9 duplicate pages/url's and are monitoring, but was curious if people had experienced this before or had any thoughts?

                    Intermediate & Advanced SEO | Mar 28, 2012, 1:56 PM | Jellyfish-Agency
                    0
                  • nicole.healthline

                    Is 404'ing a page enough to remove it from Google's index?

                    We set some pages to 404 status about 7 months ago, but they are still showing in Google's index (as 404's). Is there anything else I need to do to remove these?

                    Intermediate & Advanced SEO | Jul 19, 2011, 2:01 AM | nicole.healthline
                    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
                  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.