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

    Canonical

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

      i have some static webpages in root and wordpress installed in subdirectory , Canonical tag for the whole website was with trailing slash , i stripped the HTML extensions for static webpages but i can't force to add trailing slash to the static webpages so i changed the canonical for html webpages  from http://ghadaalsaman.com/articles.html/ to http://ghadaalsaman.com/articles but the Wordpress" http://ghadaalsaman.com/blog/ " still with trailing slash , when i've checked my google webmasters i found that my indexed pages dropped down 100 page !

      what should i put in the canonical for the static pages? i tried to strip the slash from wordpress but i failed , so my static webpages canonical  with no trailing slash and wordpress with trailing slash .

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

        Hi there,

        Every time I get into the "trailing slash vs. non-trailing slash" discussion with my clients I go back and read this excellent post in the Official Google Webmasters Central Blog by Maile Ohye: https://webmasters.googleblog.com/2010/04/to-slash-or-not-to-slash.html

        Problem for SEO: Both URLs are producing 200 OKAY status codes, resulting in duplicate content. This can interefere with crawl efficiency and fragments link equity.

        Solution: Ideally, rather than relying on canonical tags to achieve what you want, 301-redirect the non-preferred versions of your URLs to the preferred version. Only one URL should return a 200 OKAY status code. The other should 301-redirect. This is a better solution than relying on canonical tags.

        Hope that helps!

        Dana

        _nitman NeatIT 2 Replies Last reply Reply Quote 3
        • _nitman
          _nitman @danatanseo last edited by

          Completely agreed with Dana on this. I recently helped a startup fixing this problem by setting a redirect rule in their nginx configuration to redirect all the URLs with trailing slash to desired version. PFB the required rule if you're using nginx:

          rewrite ^/(.*)/$ /$1 permanent;

          If you're on LAMP/MAMP/WAMP tech stack, find the apace equivalent of this rule and place it in your apache config file. Hope that helps!

          1 Reply Last reply Reply Quote 2
          • NeatIT
            NeatIT @danatanseo last edited by

            Thanks Dana , can you help me with redirecting non trailing slash to trailing slash at the end , my wordpress is in sub dictionary http://domain.com/blog/

            and i have two .htaccess , one in root and one in the wordpress folder.

            i tried to solve it by adding that code in the root .htaccess

            RewriteEngine On
            RewriteBase /blog/
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_URI} !(.)/$
            RewriteRule ^(.
            )$ http://ghadaalsaman.com/blog/$1/ [L,R=301]

            Wordpress give 200 OK with the two versions ( with and without trailing slash ) and that hurts my SEO
            Thanks in advanced

            1 Reply Last reply Reply Quote 1
            • 1 / 1
            • First post
              Last post
            • Why Canonical error?
              MikeRoberts
              MikeRoberts
              0
              4
              95

            • After I 301 redirect duplicate pages to my rel=canonical page, do I need to add any tags or code to the non canonical pages?
              Mike.Goracke
              Mike.Goracke
              0
              2
              125

            • IP canonization
              MilanB.
              MilanB.
              0
              5
              1.3k

            • Canonical Question
              SebastianCowie
              SebastianCowie
              0
              5
              286

            • Do I have a canonical problem?
              Saijo.George
              Saijo.George
              0
              6
              449

            • Canonical efficiency
              RyanKent
              RyanKent
              0
              4
              433

            • Canonical
              Dr-Pete
              Dr-Pete
              0
              5
              636

            • Canonical tags
              paulbaguley
              paulbaguley
              0
              13
              910

            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