Forum Archive - [Solved] rel canonical

[Solved] rel canonical
Feb 11, 2012 11:53 am by [email protected]
I have a problem with yandex index because of "non canonical URLs" http://lokhnin.com/: <link rel="canonical" href="http://lokhnin.com/" /> http://lokhnin.com/de/ <link rel="canonical" href="http://lokhnin.com/" /> If I don't use canonical URLs, i have a problem with duplicates of pages Help me fix it please.
Re: rel canonical
Feb 12, 2012 2:14 pm by Edvard
Hi, You can check the selected language and add the language code in your canonical href. url-language-code-t320.html
Re: rel canonical
Feb 12, 2012 9:16 pm by [email protected]
I tried to do it. L've got the code and can use it in my canonical href. But there is another problem in thet case. My default lenguage: ru. If i translate in "fr" - all ok. Than i transkate into "uk" and: http://lokhnin.com/uk/?glang=fr $_GET['glang'] = fr
Re: rel canonical
Feb 12, 2012 9:36 pm by Edvard
When you select Ukrainian the glang will be equal to uk. Why in your case it is fr and why you add glang=fr in the end?
Re: rel canonical
Feb 14, 2012 3:59 pm by [email protected]
After changing .htacess: 1. I have URL in the browser: http://lokhnin.com/ 2. Then i click href "http://lokhnin.com/fr/" on the site, result: I have "http://lokhnin.com/fr/" in the browser $_GET['glang'] = fr 3. Than i click "http://lokhnin.com/uk/" on the site, result: http://lokhnin.com/uk/?glang=fr $_GET['glang'] = fr
Re: rel canonical
Feb 15, 2012 2:03 pm by Edvard
Yes, that is because in the URL you have another glang=fr, why that appears? The result should be http://lokhnin.com/uk/ instead of http://lokhnin.com/uk/?glang=fr
Re: rel canonical
Feb 16, 2012 10:57 am by [email protected]
May be I have made a mistake in .htacess ? # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^www.lokhnin.com [NC,OR] RewriteCond %{HTTP_HOST} ^lokhnin.ru [NC,OR] RewriteCond %{HTTP_HOST} ^www.lokhnin.ru$ [NC,OR] RewriteCond %{HTTP_HOST} ^lohnin.ru$ [NC,OR] RewriteCond %{HTTP_HOST} ^www.lohnin.ru$ [NC,OR] RewriteCond %{HTTP_HOST} ^lohnin.com$ [NC,OR] RewriteCond %{HTTP_HOST} ^www.lohnin.com$ [NC] RewriteRule ^(.*)$ http://lokhnin.com/$1 [R=301,L] RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)/(.*)$ /$1/$3 [R=301,L] RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)$ /$1/ [R=301,L] RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/(.*)$ /gtranslate/translate.php?lang=$1&url=$2&glang=$1 [L,QSA] RewriteRule ^([a-z]{2}|zh-CN|zh-TW)$ /gtranslate/translate.php?lang=$1&glang=$1 [L,QSA] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
Re: rel canonical
Feb 16, 2012 10:52 pm by Edvard
Hi, It is correct and I'm not able to replicate what you describe. I never see ?glang in the URL when I change languages... Can you try with a different browser or clear the browser cache?
Re: rel canonical
Feb 17, 2012 8:00 pm by [email protected]
I found the problem :-) Some time ago I have changed href for flags (old version: "javascript:doGTranslate('ru|uk')"): <?php echo home_url( '/' ); echo "uk"; echo $_SERVER["REQUEST_URI"]; ?> Lenguages with this constraction indexed twice better. After changing .htacess, $_SERVER["REQUEST_URI"] returns url with "?glang=uk" I will use javascript again.

SIMILAR TOPICS

[SOLVED]double dropdownOct 26, 2017 8:26 amReplies: 3Post by: danielesantosubito
[SOLVED] NOT WORKING, HELP PLEASE!Feb 12, 2017 4:53 pmReplies: 5Post by: TSM
Need help <SOLVED>Feb 6, 2017 1:48 pmReplies: 5Post by: blaxx
[solved] edit translations problemDec 15, 2011 10:05 pmReplies: 19Post by: slweb2
[Solved] Main site languageDec 9, 2016 4:39 pmReplies: 4Post by: trench

Try GTranslate with a free 15 day trial