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.

      • SEO Q&A

        Insights & discussions from an SEO community of 500,000+.

      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
    5337
    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

      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

        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

          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

            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 Reply Quote 0
            • Dillman
              Dillman last edited by

              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

                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

                  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

                    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
                    • First post
                      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

                    • brucepomeroy

                      Spammy page with canonical reference to my website

                      A potentially spammy website http://www.rofof.com/ has included a rel canonical tag pointing to my website. They've included the tag on thousands of pages on their website. Furthermore http://www.rofof.com/ appears to have backlinks from thousands of other low-value domains For example www.kazamiza.com/vb/kazamiza242122/, along with thousands of other pages on thousands of other domains all link to pages on rofof.com, and the pages they link to on rofof.com are all canonicalized to a page on my site. If Google does respect the canonical tag on rofof.com and treats it as part of my website then the thousands of spammy links that point to rofof.com could be considered as pointing to my website. I'm trying to contact the owner of www.rofof.com hoping to have the canonical tag removed from their website. In the meantime, I've disavowed the www.rofof.com, the site that has canonical tag. Will that have any effect though? Will disavow eliminate the effect of a rel canonical tag on the disavowed domain or does it only affect links on the disavowed website? If it only affects links then should I attempt to disavow all the pages that link to rofof.com? Thanks for reading. I really appreciate any insight you folks can offer.

                      Intermediate & Advanced SEO | | brucepomeroy
                      2
                    • SEOhmygod

                      Does content revealed by a 'show more' button get crawled by Google?

                      I have a div on my website with around 500 words of unique content in, automatically when the page is first visited the div has a fixed height of 100px, showing a couple of hundred words and fading out to white, with a show more button, which when clicked, increases the height to show the full content. My question is, does Google crawl the content in that div when it renders the page? Or disregard it? Its all in the source code. Or worse, do they consider this cloaking or hidden content? It is only there to make the site more useable for customers, so i don't want to get penalised for it. Cheers

                      Intermediate & Advanced SEO | | SEOhmygod
                      0
                    • andyheath

                      Magento: Should we disable old URL's or delete the page altogether

                      Our developer tells us that we have a lot of 404 pages that are being included in our sitemap and the reason for this is because we have put 301 redirects on the old pages to new pages. We're using Magento and our current process is to simply disable, which then makes it a a 404. We then redirect this page using a 301 redirect to a new relevant page. The reason for redirecting these pages is because the old pages are still being indexed in Google. I understand 404 pages will eventually drop out of Google's index, but was wondering if we were somehow preventing them dropping out of the index by redirecting the URL's, causing the 404 pages to be added to the sitemap. My questions are: 1. Could we simply delete the entire unwanted page, so that it returns a 404 and drops out of Google's index altogether? 2. Because the 404 pages are in the sitemap, does this mean they will continue to be indexed by Google?

                      Intermediate & Advanced SEO | | andyheath
                      0
                    • EcommerceSite

                      Should pages with rel="canonical" be put in a sitemap?

                      I am working on an ecommerce site and I am going to add different views to the category pages. The views will all have different urls so I would like to add the rel="canonical" tag to them. Should I still add these pages to the sitemap?

                      Intermediate & Advanced SEO | | EcommerceSite
                      0
                    • Chammy

                      Is a 404, then a meta refresh 301 to the home page OK for SEO?

                      Hi Mozzers I have a client that had a lot of soft 404s that we wanted to tidy up. Basically everything was going to the homepage. I recommended they implement proper 404s with a custom 404 page, and 301 any that really should be redirected to another page. What they have actually done is implemented a 404 (without the custom 404 page) and then after a short delay 301 redirected to the homepage. I understand why they want to do this as they don't want to lose the traffic, but is this a problem with SEO and the index? Or will Google treat as a hard 404 anyway? Many thanks

                      Intermediate & Advanced SEO | | Chammy
                      0
                    • oomdomarketing

                      Home Page Copy Ideal Length

                      Hi Guys, I'm currently trying to turn around the organic performance of a website I have been working on. I have been reading that content for home pages should be particularly long. What is the ideal length of the copy on a home page? 500 words, 1000 words, 1500 words? The current work is kind of short in my opinion, and I would like to know if it would be a worth while effort to make it longer since this thing is getting clobbered organically. Thanks!

                      Intermediate & Advanced SEO | | oomdomarketing
                      1
                    • PottyScotty

                      Creating 100,000's of pages, good or bad idea

                      Hi Folks, Over the last 10 months we have focused on quality pages but have been frustrated with competition websites out ranking us because they have bigger sites.  Should we focus on the long tail again? One option for us is to take every town across the UK and create pages using our activities.  e.g. Stirling
                      Stirling paintball
                      Stirling Go Karting
                      Stirling Clay shooting We are not going to link to these pages directly from our main menus but from the site map. These pages would then show activities that were in a 50 mile radius of the towns.  At the moment we have have focused our efforts on Regions, e.g. Paintball Scotland, Paintball Yorkshire focusing all the internal link juice to these regional pages, but we don't rank high for towns that the activity sites are close to. With 45,000 towns and 250 activities we could create over a million pages which seems very excessive!  Would creating 500,000 of these types of pages damage our site? This is my main worry, or would it make our site rank even higher for the tougher keywords and also get lots of traffic from the long tail like we used to get. Is there a limit to how big a site should be? edit

                      Intermediate & Advanced SEO | | PottyScotty
                      0
                    • imiJoe

                      Does Bing support rel="canonical" HTTP Headers?

                      anyone know^

                      Intermediate & Advanced SEO | | imiJoe
                      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.