Canonical
-
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 .
-
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 -
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!
-
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
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
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.
Related Questions
-
URL has caps, but canonical does not. Now what?
Hi, Just started working with a site that has the occasional url with a capital, but then the url in the canonical as lower case. Neither, when entered in a browser, resolves to the other. It's a Shopify site. What do you think I should do?
Technical SEO | | 945010 -
Problems with canonical urls / redirect (magento webshop)
Hi all, We're running a Magento webshop and we discover some strangs things regarding canonical urls and redirects after using the Amasty improved navigation extension. To clarify, please check these four urls. They contain the same content (the same product page). https://www.afwerkingshop.be/gyproc-gipskartonplaat-ak-2600x1200x9-5mm.html https://www.afwerkingshop.be/wanden/gyproc-gipskartonplaat-ak-2600x1200x9-5mm.html https://www.afwerkingshop.be/wanden/gipsplaten/gyproc-gipskartonplaat-ak-2600x1200x9-5mm.html https://www.afwerkingshop.be/wanden/gipsplaten/standaard/gyproc-gipskartonplaat-ak-2600x1200x9-5mm.html All these four pages have different canoncials (the page url). Obviously, that's not good. However, in Google (site:...) url (1) is the only one that's indexed. Thereby, if I visit the productpage by first going to a category page (fe. www.afwerkingshop.be/wanden.html), I'm redirected to url (1), but the canonical url is www.afwerkingshop.be/last_visited_category_name/product. So, the canonical seems dynamic depending on the last visited category. And still, only url (1) is indexed. Additionally, all aforementioned pages contain . Is anyone familiar with this issue? And more important, will it cause problems in future? Thanks in advance. Kind regards, Chendon
Technical SEO | | RBijsterveld0 -
How similar do pages need to be to utilize the canonical tag
One of my pages is a help and questions page about completing a conversions and the other is the actual campaign landing page. They are both ranking for the same term. While the subject of both pages is similar the content is not. Is the rel canonical tag appropriate here?
Technical SEO | | cbarron0 -
Moving content from CMS pages to a blog - 301 or rel canonical?
Our site has some useful information buried in out-of-the-way CMS pages, and I feel like this content is more suited to our blog. What's my best method here? 1. Move the content to a blog post, delete the original page, and 301. 2. Move the content to a blog post, leave the original page up, and rel canonical. 3. Rewrite the content so it's not a duplicate, keep original page up, and post rewritten content on the blog. 4. Something else. Some of this content has inbound links and some does not. Quite a bit of it gets long-tail traffic already. It just looks kludgy because it's on pages that really aren't designed for articles. It would look much nicer and be much more readable/shareable/linkable on the blog.
Technical SEO | | CMC-SD0 -
Categories and rel canonical
Hello everyone, I have a doubt in how to approach this problem. I have a local business website, and i want to rank this website for our main KW. So the idea is to rank the main Keyword to the home page www.sitename.com At the same time we blog every week and one of the categories is the same has the main Keyword. It makes sense because the majority of the blog posts are about it. In a certain way the homepage and the category page are competing for the same keyword. How can i approach this problem? Should i use rel canonical in the category page, pointing to the homepage? Thanks for your help.
Technical SEO | | Barbio0 -
Should i use NoIndex, Follow & Rel=Canonical Tag In One Page?
I am having pagination problem with one of my clients site , So I am deciding to use noindex, follow tag for the Page 2,3,4 etc for not to have duplicated content issue, Because obviously SEOMoz Crawl Diagnostics showing me lot of duplicate page contents. And past 2 days i was in constant battle whether to use noindex, follow tag or rel=canonical tag for the Page 2,3,4 and after going through all the Q&A,None of them gives me crystal clear answer. So i thought "Why can't i use 2 of them together in one page"? Because I think (correct me if i am wrong) 1.noindex, follow is old and traditional way to battle with dup contents
Technical SEO | | DigitalJungle
2.rel=canonical is new way to battle with dup contents Reason to use 2 of them together is: Bot finds to the non-canonical page first and looks at the tag nofollow,index and he knows not to index that page,meantime he finds out that canonical url is something something according to the url given in the tag,NO? Help Please???0 -
Is having "rel=canonical" on the same page it is pointing to going to hurt search?
i like the rel=canonical tag and i've seen matt cutts posts on google about this tag. for the site i'm working on, it's a great workaround because we often have two identical or nearly identical versions of pages: 1 for patients, 1 for doctors. the problem is this: the way our content management system is set up, certain pages are linked up in a number of places and when we publish, two different versions of the page are created, but same content. because they are both being made from the same content templates, if i put in the rel=canonical tag, both pages get it. so, if i have: http://www.myhospital.com/patient-condition.asp and http://www.myhospital.com/professional-condition.asp and they are both produced from the same template, and have the same content, and i'm trying to point search at http://www.myhospital.com/patient-condition.asp, but that tag appears on both pages similarly, we have various forms and we like to know where people are coming from on the site to use those forms. to the bots, it looks like there's 600 versions of particular pages, so again, rel=canonical is great. however, because it's actually all the same page, just a link with a variable tacked on (http://www.myhospital.com/makeanappointment.asp?id=211) the rel=canonical tag will appear on "all" of them. any insight is most appreciated! thanks! brett
Technical SEO | | brett_hss0 -
Rel canonical or 301 the Index Page?
Still a bit confused on best practice for /index.php showing up as duplicate for www.mysite.com. What do I need to do and How?
Technical SEO | | bozzie3110