Forums / General Questions / canonicalLink not working on

canonicalLink not working on

Views: 808

Results 1 to 5 of 5
28 Jun 2016, 2:24 AM
#1
tadj_hemingway avatar

tadj_hemingway

New Zenner

Join Date:
Apr 2013
Location:
Eastpointe, Michigan, United States
Posts:
20
Plugin Contributions:
0

canonicalLink not working on

Hello, I am running zen cart version 1.5.1 with several add on plugins and recently I noticed that my canonicalLink was not working. I'm assuming it's because of some add on either eliminated or created an error on one of the files. Please let me know what files control the canonicalLink so I can see where the error is and fix it.
Thanks

28 Jun 2016, 4:32 AM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: canonicalLink not working on

The template basically controls whether or not to display the canonical link. If there is reason to believe that an error is being generated, then this will typically manifest as a white page or a partial white page. But regardless would/should log a myDebug file to the logs directory beginning in ZC 1.5.1. Otherwise try temporarily changing to the default ZC template and see if your canonical link is restored for display.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

28 Jun 2016, 4:55 AM
#3
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: canonicalLink not working on

Tadj Hemingway:

Please let me know what files control the canonicalLink so I can see where the error is and fix it.

/includes/init_includes/init_canonical.php .....is where they are defined

/includes/templates/YOURTEMPLATE/common/html_header.php ....... is where the are output.

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

14 Feb 2017, 11:57 AM
#4
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,876
Plugin Contributions:
7

Re: canonicalLink not working on

Some info just to help me next time I have this problem and can't remember the answer.

I found the $canonicallink was not being generated ...and eventually discovered it was due to viewing the page as ssl (https) BUT HTTP_SERVER was http.

This is trapped by the code in init_canonical:

  case ($request_type == 'SSL' && substr(HTTP_SERVER, 0, 5) != 'https'):
    $canonicalLink = '';

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

14 Feb 2017, 4:36 PM
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: canonicalLink not working on

torvista:

Some info just to help me next time I have this problem and can't remember the answer.

I found the $canonicallink was not being generated ...and eventually discovered it was due to viewing the page as ssl (https) BUT HTTP_SERVER was http.

This is trapped by the code in init_canonical:

case ($request_type == 'SSL' && substr(HTTP_SERVER, 0, 5) != 'https'):
$canonicalLink = '';

This appears to have been from an earlier design consideration that https sites/pages would not be indexed, but it is also a reason why the suggestion of the way to implement full site https: is provided in the following FAQ: <https://www.zen-cart.com/content.php?56-how-do-i-enable-ssl-after-i-have-installed-zen-cart>

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...