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
-
Canonical Page Question
Hi, I have a question relation to Canonical pages That i need clearing up. I am not sure that my bigcommere website is correctly configured and just wanted clarification from someone in the know. Take this page for example https://www.fishingtackleshop.com.au/barra-lures/ Canonical link is https://www.fishingtackleshop.com.au/barra-lures/ The Rel="next" link is https://www.fishingtackleshop.com.au/barra-lures/?sort=bestselling&page=2 and this page has a canonical tag as rel='canonical' href='https://www.fishingtackleshop.com.au/barra-lures/?page=2' /> Is this correct as above and working as it should or should the canonical tag for the second (pagination page) https://www.fishingtackleshop.com.au/barra-lures/?page=2 in our source code be saying rel='canonical' href='https://www.fishingtackleshop.com.au/barra-lures/' />
Technical SEO | | oceanstorm0 -
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 -
Stuck with canonical URL - main site vs categorys?
Hello, I started to doubt myself. We have a classified advertisements website. On the main www.website.com page, almost all the advertisements are shown. Now we take those advertisements and also split them into categorys Category 1 / category 2 / category 3 / category 4 Now all those categories almost always have the same content as www.website.com except a bit less (because X amount of content is now divided also to 4-5 groups) For raking should i actually tell google that those categories are a copy of www.website.com or they should still be as they are?
Technical SEO | | advertisingcloud0 -
Should summary pages have the rel canonical set to the full article?
My site has tons of summary pages, Whether for a PDF download, a landing page or for an article. There is a summary page, that explains the asset and contains a link to the actual asset. My question is that if the summary page is just summary of an article with a "click here to read full article" button, Should I set the rel canonical on the summary page to go to the full article? Thanks,
Technical SEO | | Autoboof0 -
Canonical link tag for https - any disadvantages for SEO?
Hi Mozzers, We have a website that has both http as well as https indexed. I proposed the solution of implementing a canonical link tag on all pages (including the login/secure ones). Any disadvantages I could expect? Thanks!
Technical SEO | | DeptAgency0 -
Canonical tags
How hard is it to put in Canonical tags on a webpage? My web guy didn't do it because he put in redirects in place for all old URLs and all content
Technical SEO | | Boodreaux
(except error pages and advanced searches) should have a unique URL. By not having canonical tags does it lose link juice? Not sure if that question makes sense. 🙂 Poo1 -
Which is best of narrow by search URLs? Canonical or NOINDEX
I have set canonical to all narrow by search URLs. I think, it's not working well. You can get more idea by following URLs. http://www.vistastores.com/table-lamps?material_search=1328 http://www.vistastores.com/table-lamps?finish_search=146 These kind of page have canonical tag which is pointing to following one. http://www.vistastores.com/table-lamps Because, it's actual page which I want to out rank. But, all narrow by search URLs have very different products compare to base URLs. So, How can we say it duplicate one? Which is best solution for it. Canonical or NOINDEX it by Robots?
Technical SEO | | CommercePundit0 -
Canonical tag used on several pages?
Is it a bad idea to use rel=canonical from several pages back to one (if you are planning on no-indexing them)? Does this concentrate the “link juice” from those several pages back to one?
Technical SEO | | nicole.healthline0