Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 03-29-2013 08:59:21

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

How to add canonical url to head

Please can you tell me how to add canonical seourls to the pages.


Simon

Offline

 

#2 04-01-2013 08:56:21

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19818
Website

Re: How to add canonical url to head

You can do this in your .htaccess file following instructions similar to:

http://stackoverflow.com/questions/1008 … r-subfold#


Nick Hendler

Offline

 

#3 04-01-2013 09:11:27

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: How to add canonical url to head

Do you mean putting


RewriteCond %{HTTP_HOST} !^www\.quasarelectronics\.co\.uk\/$
RewriteRule (.*) http://www.quasarelectronics\.co\.uk\/$1 [R=301,L]

will do the same job as adding <link rel="canonical" href="http://www.electronickits.uk.com/Item/theseourl"> to the page head section?


Simon

Offline

 

#4 04-02-2013 10:35:48

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19818
Website

Re: How to add canonical url to head

No, I thought you meant you wanted canonical URLs handled appropriately via your server responses.  To add that link rel code to the top of your pages, edit your skin.php file for your skin and put this in the head:

Code:

<?php 

$canonicalurl = $this->globals('core.requesturi');
$canonicalurl = @strip_tags($canonicalurl);
$canonicalurl = $this->xhtml_encode($canonicalurl);

?>

<link rel="canonical" href="<?php print $canonicalurl; ?>">

Nick Hendler

Offline

 

#5 04-02-2013 10:48:32

sdn
Member
From: UK
Registered: 05-29-2007
Posts: 882

Re: How to add canonical url to head

Thanks. I guessed that was one way to do it but my knowledge of programming is not good enough for me to figure out the "core.requesturi" part.


Simon

Offline

 

#6 04-12-2013 13:13:39

Blitzen
Member
From: USA
Registered: 01-01-2005
Posts: 936

Re: How to add canonical url to head

Does
$this->globals('core.requesturi');
return the current page URI?

Last edited by Blitzen (04-12-2013 13:13:50)

Offline

 

#7 04-15-2013 07:53:55

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19818
Website

Re: How to add canonical url to head

Yes, it does.


Nick Hendler

Offline

 

#8 04-16-2013 11:02:06

Blitzen
Member
From: USA
Registered: 01-01-2005
Posts: 936

Re: How to add canonical url to head

Using the REQUEST_URI is not quite the way to build your canonical tags. If you had a clean launch that used only one URL being used for the page (that includes all inbound links to that page that SE's might discover your page), then canonical tags are not really necessary for most pages. It can help if links to the page have different URLs. But, it's more complex than that.

If you have duplicated content (more than one URL points to a page with the same content), then the preferred canonical URL should be unique to the page content being presented. For example, you have a category that spills over to pages 1, 2,  and 3. The canonical URL on ALL these pages (for that category ) should be the same URL. If you allow the user to change the number of items on a page or filter the pages, this really gives many URLs to the same "content". And, using REQUEST_URI will give several canonical URLs to the same "content". And, that's not canonical.

You also dilute your strength of your key phrases site-wide.

Don't get confused. "Duplicated Content" doesn't mean every word on the page is the same. In the eyes of the SE, every page for that category has the same content (such as category name and description) except for a listing of products. Today's SE technology is smart and recognizes the 3 category pages as duplicated content. They are looking for valuable and unique content such as your category descriptions - not a listing of products/links. They will recognize the repetitive structure of the product listings on the category page.

Don't fret, SE's will follow the links to find & index your products.

Look up "Link Sculpting" or "Bot Herding" for more information. There are other tags & strategies used for proper link sculpting and concentrating your key phrases.

p.s. We've managed to properly sculpt the links for our clients' CCP8 websites. Due to the architecture of CCP8, it involved editing in more than one place, so I cannot post the solution here - it's not a pretty solution.

Offline

 

#9 06-12-2014 04:50:14

Graham
Member
Registered: 09-30-2004
Posts: 983
Website

Re: How to add canonical url to head

I've used the canonical code from above and appropriate 301 redirects in my htaccess file, but Google Web Master Tools is still telling me I've got Duplicate Meta Descriptions eg

Leather Gloves
http://www.affordable-leather.co.uk/cat … loves.html
http://www.affordable-leather.co.uk/ccp … st-lace-up
http://www.affordable-leather.co.uk/ccp … rt=PRICEUP

This is appearing on a lot of pages, so is there a way to fix this?

Offline

 

#10 06-12-2014 09:59:18

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19818
Website

Re: How to add canonical url to head

For the first one, it looks like you have old non-standard URLs to rewrite.  Look here:

http://wiki.kryptronic.com/CCP8SearchEngineOptimization

You'll want to add these:

Code:

RewriteRule ^ccp8/cat--(.*)--(.*)\.html ccp8/index.php?app=ecom&ns=catshow&ref=$2 [L,PT]
RewriteRule ^ccp8/item--(.*)--(.*)\.html ccp8/index.php?app=ecom&ns=prodshow&ref=$2 [L,PT]
RewriteRule ^ccp8/page--(.*)--(.*)\.html ccp8/index.php?app=cms&ns=display&ref=$2 [L,PT]
RewriteRule ^ccp8/store ccp8/index.php?app=ecom&ns=splash [L,PT]
RewriteRule ^ccp8/splash ccp8/index.php?app=cms&ns=display&ref=splash [L,PT]

The second URL is valid, just a case issue.  Google should fix this on it's own.

For the last one, suppress the 'prodsort' CGI variable in webmaster tools.  Tell Google it's for pagination.


Nick Hendler

Offline

 

#11 06-12-2014 16:57:37

Graham
Member
Registered: 09-30-2004
Posts: 983
Website

Re: How to add canonical url to head

webmaster wrote:

For the first one, it looks like you have old non-standard URLs to rewrite.  Look here:

http://wiki.kryptronic.com/CCP8SearchEngineOptimization

You'll want to add these:

[...] The second URL is valid, just a case issue.  Google should fix this on it's own.

I already have those redirects in htaccess, also I'm re-writing the upper case versions to lower case ie:

Code:

# Redirect Item to item and Category to category

RewriteRule ^ccp8/Item/(.*) http://www.affordable-leather.co.uk/ccp8/item/$1 [R=301,L]
RewriteRule ^ccp8/Category/(.*) http://www.affordable-leather.co.uk/ccp8/category/$1 [R=301,L]

As such, I'm not sure why it's still having a problem.

For the last one, suppress the 'prodsort' CGI variable in webmaster tools.  Tell Google it's for pagination.

I've just looked at that and it seems to have recognised that it doesn't affect content.

My concern is that it's telling me I've got 401 pages with duplicate meta descriptions which is virtually every page on my site, so I really would like to get this sorted in case it causes problems.

Offline

 

#12 06-13-2014 08:00:42

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19818
Website

Re: How to add canonical url to head

For these:

RewriteRule ^ccp8/Item/(.*) http://www.affordable-leather.co.uk/ccp8/item/$1 [R=301,L]
RewriteRule ^ccp8/Category/(.*) http://www.affordable-leather.co.uk/ccp8/category/$1 [R=301,L]

Did you change the namespace SEOurl for 'ecom.prodshow' and 'ecom.catshow' to use lowercase strings?


Nick Hendler

Offline

 

#13 06-13-2014 12:06:58

Graham
Member
Registered: 09-30-2004
Posts: 983
Website

Re: How to add canonical url to head

webmaster wrote:

Did you change the namespace SEOurl for 'ecom.prodshow' and 'ecom.catshow' to use lowercase strings?

I'm not sure.

I've looked in System Dashboard > System > Namespaces > Namespaces and the SEOurl for prodshow is /item/{SEOURL:ecom_prod} and the one for catshow is /category/{SEOURL:ecom_cat}

Are those the ones you're referring to?

Offline

 

#14 06-16-2014 07:49:03

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19818
Website

Re: How to add canonical url to head

Yes, and it appears you did change them.  They should be 'Item' and 'Category'.


Nick Hendler

Offline

 

#15 06-16-2014 09:41:25

Graham
Member
Registered: 09-30-2004
Posts: 983
Website

Re: How to add canonical url to head

webmaster wrote:

Yes, and it appears you did change them.  They should be 'Item' and 'Category'.

But, as mentioned above, I'm re-writing Item to item and Category to category with 301 redirects, so surely that should fix this issue?

Offline

 

#16 06-17-2014 08:41:18

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19818
Website

Re: How to add canonical url to head

Right.  So at this point you should have no issues.  Your .htaccess looks good.


Nick Hendler

Offline

 

#17 06-17-2014 12:13:41

Graham
Member
Registered: 09-30-2004
Posts: 983
Website

Re: How to add canonical url to head

webmaster wrote:

Right.  So at this point you should have no issues.  Your .htaccess looks good.

Unfortunately Google WMTs thinks otherwise.

The latest Search Appearance > HTML Improvements says I've still got 390 Duplicate Meta Descriptions even though it was updated yesterday and all the above changes have been in operation longer than that.

I can't see why it's not accepting a canonical URL

Offline

 

#18 06-23-2014 13:12:01

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19818
Website

Re: How to add canonical url to head

Is your issue duplicate meta info, or duplicate URL content?


Nick Hendler

Offline

 

#19 06-23-2014 15:50:30

Graham
Member
Registered: 09-30-2004
Posts: 983
Website

Re: How to add canonical url to head

Cutting and pasting from WMTs:

* * * * *

HTML Improvements Last updated Jun 23, 2014

Addressing the following may help your site's user experience and performance.
Meta description     Pages

Duplicate meta descriptions     409
Long meta descriptions     0
Short meta descriptions     492

Title tag     Pages

Missing title tags     0
Duplicate title tags     318


* * * * *

Cutting and pasting a few of the Duplicate Meta Descriptions:

Pages with duplicate meta descriptions

Nice and Nasty Vampire Gloves
/ccp8/gloves/nice-and-nasty-vampire-gloves--GLV5.html
/ccp8/item/spiked-vampire-gloves

Rose Tip Riding Crop
/ccp8/item/WHIP9
/ccp8/item/leather-rose-tipped-riding-crop-whip
/shop/riding-crops/rose-tip-riding-crop--WHIP9.html

Coffin Paddle
/ccp8/item/PAD08
/ccp8/item/leather-and-suede-studded-coffin-shape-spanking-paddle

Rubber Bit Gag with Leather Strap
/ccp8/gags-ball-bit-penis-bridle-ring-etc-/bit-gag--GAG02.html
/ccp8/item/rubber-bit-gag

Leather Gloves
/cat--Gloves--Gloves.html
/ccp8/index.php?app=ecom&ns=catshow&ref=Gloves&prodsort=PRICEDN
/ccp8/index.php?app=ecom&ns=catshow&ref=Gloves&prodsort=PRICEUP

* * * * *

Cutting and pasting from Duplicate Title Tags:

Pages with duplicate title tags    

Wet Brand Lubes - Affordable Leather Products UK
/ccp8/category/Wet_Brand_Lubes
/ccp8/index.php?app=ecom&ns=catshow&ref=Wet_Brand_Lubes&prodsort=PRICEDN

FLG 29 - Soft Suede Cat o’Nine Tails - Affordable Leather Products UK
/ccp8/cats/soft-suede-cat-o-nine-tails--FLG29.html
/ccp8/floggers/soft-suede-cat-o-nine-tails--FLG29.html

RAB 4 - Jessica Rabbit - Affordable Leather Products UK
/ccp8/item/RAB4
/ccp8/item/jessica-rabbit-vibrator

Paddles - Affordable Leather Products UK
/ccp8/category/Paddles
/ccp8/category/leather-suede-bdsm-paddles

Rubber Hoods - Affordable Leather Products UK
/ccp8/category/latex-rubber-hoods
/ccp8/index.php?app=ecom&ns=catshow&ref=Rubber_Hoods&prodsort=DEFAULT
/ccp8/index.php?app=ecom&ns=catshow&ref=Rubber_Hoods&prodsort=PRICEUP

* * * * *

NB All of the above have appropriate 301 redirects as far as I can see, ie mousing over them in WMTs shows the correct page/ content.

Offline

 

#20 06-26-2014 03:52:50

Graham
Member
Registered: 09-30-2004
Posts: 983
Website

Re: How to add canonical url to head

Graham wrote:

Cutting and pasting from WMTs:

* * * * *

HTML Improvements Last updated Jun 23, 2014

Addressing the following may help your site's user experience and performance.
Meta description     Pages

Duplicate meta descriptions     409
Long meta descriptions     0
Short meta descriptions     492

Title tag     Pages

Missing title tags     0
Duplicate title tags     318

Hmm, I don't know what just happened, however these numbers have somehow just plummetted!

* * * * *

HTML Improvements Last updated Jun 25, 2014

Addressing the following may help your site's user experience and performance.
Meta description     Pages

Duplicate meta descriptions     6
Long meta descriptions     0
Short meta descriptions     31

Title tag     Pages

Missing title tags     0
Duplicate title tags     6
Long title tags     0

* * * * *

I'm wondering whether, although google said the results had been updated, there was still some data cached by WMTs or similar that was causing it to report bogus duplicates that no longer existed and that data which has now expired, hence the massive drop.

Offline

 

#21 06-27-2014 05:13:59

magwa
Member
Registered: 09-22-2007
Posts: 321

Re: How to add canonical url to head

I'm a little puzzled and would appreciate some clarification.
Blitzen says "Using the REQUEST_URI is not quite the way to build your canonical tags"

What is the correct method?

Offline

 

#22 06-27-2014 13:31:35

robash
Member
Registered: 02-10-2013
Posts: 344

Re: How to add canonical url to head

I added this to my site on the 12 may and webmaster tools still reports duplicate meta descriptions for:
/
/index.php


Code:

<?php 

$canonicalurl = $this->globals('core.requesturi');
$canonicalurl = @strip_tags($canonicalurl);
$canonicalurl = $this->xhtml_encode($canonicalurl);

?>

<link rel="canonical" href="<?php print $canonicalurl; ?>">

Rob

God Save The Queen

Offline

 

#23 06-27-2014 16:38:13

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19818
Website

Re: How to add canonical url to head

You might get by with:

Code:

if ($canonicalurl == '/index.php') {$canonicalurl = '/';}

At the bottom of your codeblock before the URL is printed.


Nick Hendler

Offline

 

#24 06-28-2014 15:25:42

josieboy
Member
Registered: 06-24-2014
Posts: 7

Re: How to add canonical url to head

hey Blitzen, I am interested in your solution - pretty or not !

Offline

 

Board footer