[Solved] rel canonical

Popular automatic website translation tool

[Solved] rel canonical

Postby [email protected] » Sat Feb 11, 2012 3:53 pm

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.
[email protected]
 
Posts: 7
Joined: Sat Jul 23, 2011 3:18 pm

Re: rel canonical

Postby Edvard » Sun Feb 12, 2012 6:14 pm

Hi,

You can check the selected language and add the language code in your canonical href.

url-language-code-t320.html
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4349
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: rel canonical

Postby [email protected] » Mon Feb 13, 2012 1:16 am

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
[email protected]
 
Posts: 7
Joined: Sat Jul 23, 2011 3:18 pm

Re: rel canonical

Postby Edvard » Mon Feb 13, 2012 1:36 am

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?
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4349
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: rel canonical

Postby [email protected] » Tue Feb 14, 2012 7:59 pm

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
[email protected]
 
Posts: 7
Joined: Sat Jul 23, 2011 3:18 pm

Re: rel canonical

Postby Edvard » Wed Feb 15, 2012 6:03 pm

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
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4349
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: rel canonical

Postby [email protected] » Thu Feb 16, 2012 2:57 pm

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
[email protected]
 
Posts: 7
Joined: Sat Jul 23, 2011 3:18 pm

Re: rel canonical

Postby Edvard » Fri Feb 17, 2012 2:52 am

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?
Regards,

Edvard Ananyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Edvard
Site Admin
 
Posts: 4349
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: rel canonical

Postby [email protected] » Sat Feb 18, 2012 12:00 am

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.
[email protected]
 
Posts: 7
Joined: Sat Jul 23, 2011 3:18 pm


  • Related Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests

2GLux
cron