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
-
Duplicate title while setting canonical tag.
Hi Moz Fan, My websites - https://finance.rabbit.co.th/ has run financial service, So our main keywords is about "Insurance" in Thai, But today I have an issues regarding to carnonical tag. We have a link that containing by https://finance.rabbit.co.th/car-insurance?showForm=1&brand_id=9&model_id=18&car_submodel_id=30&ci_source_id=rabbit.co.th&car_year=2014 and setting canonical to this url - https://finance.rabbit.co.th/car-insurance within 5,000 items. But in this case I have an warning by site audit tools as Duplicate Page Title (Canonical), So is that possible to drop our ranking. What should we do, setting No-Index, No-Follow for all URL that begin with ? or keep them like that.
Technical SEO | | ASKHANUMANTHAILAND0 -
Rel=canonical on Godaddy Website builder
Hey crew! First off this is a last resort asking this question here. Godaddy has not been able to help so I need my Moz Fam on this one. So common problem My crawl report is showing I have duplicate home pages www.answer2cancer.org and www.answer2cancer.org/home.html I understand this is a common issue with apache webservers which is why the wonderful rel=canonical tag was created! I don't want to go through the hassle of a 301 redirect of course for such a simple issue. Now here's the issue. Godaddy website builder does not make any sense to me. In wordpress I could just go add the tag to the head in the back end. But no such thing exist in godaddy. You have to do this weird drag and drop html block and drag it somewhere on the site and plug in the code. I think putting before the code instead of just putting it in there. So I did that but when I publish and inspect in chrome I cannot see the tag in the head! This is confusing I know. the guy at godaddy didn't stand a chance lol. Anyway much love for any replies!
Technical SEO | | Answer2cancer0 -
Rel-canonical and meta data
Hey Mozzers, Help please. I am migrating content for a new website (1000's of pages) and am using the canonical tag on a number of pages. For the pages which I am asking Google not to recognise / index as the master version, and in the interests of time do I need to take the time to fill in the meta <title><description> etc each time?</p> <p>Ben</p></title>
Technical SEO | | Bendall0 -
Set Canonical for Paginated Content
Hi Guys, This is a follow up on this thread: http://moz.com/community/q/dynamic-url-parameters-woocommerce-create-404-errors# I would like to know how I can set a canonical link in Wordpress/Woocommerce which points to "View All" on category pages on our webshop.
Technical SEO | | jeeyer
The categories on my website can be viewed as 24/48 or All products but because the quanity constantly changes viewing 24 or 48 products isn't always possible. To point Google in the right direction I want to let them know that "View All" is the best way to go.
I've read that Google's crawler tries to do this automatically but not sure if this is the case on on my website. Here is some more info on the issue: https://support.google.com/webmasters/answer/1663744?hl=en
Thanks for the help! Joost0 -
Canonical & rel=prev / next changes to website a good idea or not?
Hi all, I decided yesterday to make a load of changes to my website, and today i woke thinking, should i have done that! So below is an example of what i have done (i will try to explain clearly anyway), can you let me know if you think what i have done would harm or help my website in search results etc... ok, so lets take just one category - Cameras And it has the sub categories - box dome bullet it also has other sub categories (which are actually features, but the only way i can show them on my site is by having them as a sub-category with its own static page, and adding the products to these as secondary categories) vandal proof high resolution night vision previously i have it set up so that every single category / sub category / feature had its own static page, with a canonical tag to itself (i.e cameras.html canonical was to cameras.html, vandalproof.html canonical was to vandalproof.html). Any of the categories / sub cats / features that had more than one page were simply not in search results due to the canonical pointing to "Page 1"... What i have now done: Last night i decided to change all this, now for all categories / sub cats / features i have add rel=prev / next where applicable, and removed the canonical from second / third / fourth pages etc, but left the canonical on "page 1". I also removed any keywords from page 2,3,4 etc and changed descriptions to just page "X" + category name. So for example, page one looks like: and page two looks like: I also went a little further (maybe too far) and decided that the features pages would canonicalize back to cameras so for those i now have: Page 1: Page 2: Any advice is welcome on the above, in regards to which way may be better and why, and obviously if anything jumps out as a mistake... Please advise James
Technical SEO | | isntworkdull0 -
My number of duplicate page title and temporary redirect warnings increased after I enabled Canonical urls. Why? Is this normal?
After receiving my first SEO moz report, I had some duplicate page titles and temporary redirects. I was told enabling Canonical urls would take of this. I enabled the Canonical URLs, but the next report showed that both of those problems had increased three fold after enabled the canonical urls! What happened?
Technical SEO | | btsseo780 -
On page audit throws a rel="canonical" curve ball :-(
Good Morning from -3 Degrees C, still no paths gritted wetherby UK 😞 Following an on page audit one recommendation instructs me to ad:
Technical SEO | | Nightwing
http://www.barrettsteel.com/" /> on the home page of barrett steel. I'm confused, i thought i only had to add this to duplications
the home page which to my knowledge dont exist. So my question is please: "Why shoul i ad this snippet of code on the home page of http://www.barrettsteel.com http://www.barrettsteel.com/" /> Any insights welcome 🙂0 -
Confused about rel="canonical"
I'm receiving a duplicate content error in my reports for www.example.com and www.example.com/index.htm. Should I put the rel="canonical" on the index page and point it to www.example.com? And if I have other important pages where rel="canonical" is being suggested do I place the rel="canonical" on that page? For example if www.example/product is an important page would I place on that page?
Technical SEO | | BrandonC-2698870