Canonical etiketi ayarlarken, i kanonik amaç dışında tüm suyu almıyorum öğrendim ...
GIVEN
Currently ugly urls like website.org/juice?ln=de
are made nice via apache, reachable in more userfriendly way, like website.org/de/juice
. Now, in this multi-lingual website, I wish for consistency and all pages to have their languages as a folder. I wish the search engines to remember and prefer those /language/page
as opposed to their ugly counterparts /page?ln=language
.
Question 1: ben orada arama motorlarına bu iletişim Kurallı kullanmak istiyorum nasıl doğru yolda sofar mıyım?
CURRENTLY the code removes unneccessary strings sothat canonical urls are short:
when URL = http://website.org/de/juice?ln=whatever
canocal url= http://website.org/de/juice
Sofar so good, BUT, it does not rewrite the old files roaming on the net/old search engine cache memories, and thus following situations go wrong:
when URL = http://website.org/juice?ln=xyz (missing language folder)
then canonical becomes = http://website.org/juice (whereas it should be http://website.org/xyz/juice
Question 2: i iyileştirmek için yapılacak, kodumu ne eklemek gerekir / şaşmaz benim hiçbir dil klasör kümesi vardır durumları tanır sothat kanonik?
<?php
$domain = $_SERVER['HTTP_HOST']; #domain like website.org
$qsIndex = strpos($extensions, '?'); # strip off of string/query part (?ln=xyz)
$pageclean = $qsIndex !== FALSE ? substr($extensions, 0, $qsIndex) : $extensions;
$canonical = "http://" . $domain . $pageclean;
?>
<html><head><link rel="canonical" href="<?=$canonical?>"></head>...
Not: diller {de, nl, es, bu, en, la, .... ama aynı zamanda zh-CN, zh-TW} yüzden bundan sonra ne gelirse ln?=
gibi şeyler olabilir