You are here:  » Canocical url category


Canocical url category

Submitted by wesse249 on Sat, 2016-05-28 16:19 in

Hello David is asked earlier. But i'd like to have canocical urls for my category, merchant and brand pages.

I wan't this because i worked with subdomains and these subdomains have alle the same url's as my main site. It takes a long time before these url's are deleted from google. So when i add canacical url's i don't risk duplicate content. Can you tell me how i can make this?

Thank you very much.

Jan Roel

Submitted by support on Mon, 2016-05-30 13:27

Hello Jan,

Sure - please could you give me an example URL (I'll remove before posting your reply), and for that URL an example of what you would like the canonical to be, and I'll point you in the right direction...

Thanks,
David.
--
PriceTapestry.com

Submitted by wesse249 on Mon, 2016-05-30 14:42

Hello,

Category:

http://example.nl/category/Category-Name/

<link rel='canonical' href='http://example.nl/category/Category-Name/' />

Merchant:

http://example.nl/merchant/Merchant-Name/

<link rel='canonical' href='http://example.nl/merchant/Merchant-Name/' />

Brand:

http://example.nl/brand/Brand-Name/

<link rel='canonical' href='http://example.nl/brand/Brand-Name/' />

Thank you very much.

Jan Roel

Submitted by support on Tue, 2016-05-31 10:57

Hello Jan,

Sure - first add support for a new $header["canonical"] variable. Edit html/header.php and look for the following code at line 34:

  </head>

...and REPLACE with:

  <?php if (isset($header["canonical"])): ?>
    <link rel='canonical' href='<?php print $header["canonical"]; ?>' />
  <?php endif; ?>
  </head>

And then to set the canonical value for rewritten Merchant / Category / Brand A-Z results, edit search.php and look for the following code at line 522:

  require("html/header.php");

...and REPLACE with:

  if ($rewrite)
  {
    $header["canonical"] = "http://example.nl".$_SERVER["REQUEST_URI"];
  }
  require("html/header.php");

Hope this helps!

Cheers,
David.
--
PriceTapestry.com