Jump to content

Urls are the same for all the languages - seo problem


Recommended Posts

Hi,

First thanks for this program that i find to be great.
I plan to do a shop in 3 languages (English, French and Japanese). I will do the Japanese translation and put it on the website so everybody can use it.
Thus I would like to point a problem that's already been discussed. If you use PS with multi-language, the urls are the same as the language var pass through session ID.
That's a very bad thing for SEO. I though it will be corrected in the 1.1 version but it still the same.
Do you plan to correct this problem anytime soon?

An other problem is that when you change the language in the home page, the home page URL include "/index.php".
This is a duplicate content.

Thanks

Link to comment
Share on other sites

I could be wrong (but don't think so) but it's unlikely that there will be any adverse effect from having this. There is no such thing as a "duplicate content penalty"as far as google is concerned; it's an urban myth ;)

What CAN happen is that if there is more than one url pointing to the exact same content, then google will pick one of the as the "canonical" this has the effect of diluting credit across the duplicates.

Take the example of the classic:

http://www.example.com and
http://example.com

Why is this bad? Well half of your backlinks may point to the first and the other half the second, which means you have two pages with half the page rank each rather than one (which it is!) with all the page rank. Not good.

In themcase of multiple languages, then google will index in the default language, but since the page name is identical, there will be no adverse effect regardless of what language folks link to your page in.

Paul

Link to comment
Share on other sites

Hi thanks for your answer.
About duplicate content, I was only talking about the last sentence:
An other problem is that when you change the language in the home page, the home page URL include “/index.php”.
www.mysite.com and www.mysite.com/index.php is exactly the same page. This is duplicate content.

About multilanguage, you say google will index the default language. Google seems to index any page he found so he will probably try to index all the languages. Than mean that sometimes he gonna index a page in English maybe an other one in French and an other one in Japanese.
The idea is to have all the pages in all the languages indexed...
And anyway many pages names are different for each language (products).

There is no much point to have a multilanguage website if only one language is indexed.

Link to comment
Share on other sites

For the first point, I'm not sure I understand you, but yes they could be the same content, or they could be different depending on your site. This is similar to the issue with the different forms (with and without the www) and would normally be handled by yourself, not the cart - some people may want a different page for www.example.com than www.example.com/index.php; there are many good reasons to do that.

I had made the assumption that the language selection was being handled by javascript, when in fact it isn't. I think it may also not display the urls with the language parameter when any other language than the default is selected. In lynx it will only display the default language if cookies are rejected. It certainly needs to be reviewed, as I would have liked to see the language id parameter being included when cookies are disabled (or even just for known search engine bots). Maybe one of the PrestaShop development team can give advice on what the search engines see when crawling your site (and cookies are disabled).

Apologies for my incorrect initial assessment.

Paul

Link to comment
Share on other sites

I have just jumped onto the bandwagon (and into the forum) to answer this topic.

Multiple language websites handling for SEO is a quite sensitive subject. I had written a post on my SEO blog a while ago (in French) (référencement de sites multilingues)

Handling the languages changes with a cookie is one of the worst solutions as it will allow access only to the default language version.

Using parameters passed in the URLs can do the trick, but this solution can lead to errors. I have seen interesting ones on a website powered by Typo 3 that used this solution.

In fact the absolute best solution is to have a different domain name for each language version. It is the only one that is fully functional as it will allow your website to appear on regional versions of search engines.
If your website is in France, with a .fr extension, it will have a very hard time appearing on google.co.uk with its English section.

This access problem is just one part of the language issue. The other one is the localization. I do not (yet) know PrestaShop, but many other shopping cart scripts will localize only the interface, not the product descriptions. You need to be able to set up every aspect of a product or product category in each language and so have multiple inputs in the back-office.

Link to comment
Share on other sites



This access problem is just one part of the language issue. The other one is the localization. I do not (yet) know PrestaShop, but many other shopping cart scripts will localize only the interface, not the product descriptions. You need to be able to set up every aspect of a product or product category in each language and so have multiple inputs in the back-office.


That part is fully functional, but access to the different translations for the front-end isn't; from a SEO perspective.

Paul
Link to comment
Share on other sites

I guess the best thing would be to have a virtual directory for each language except for the default language like this:
http://www.site.jp/3-accessories-ipod for default language (here japanese)
http://www.site.jp/en/3-accessories-ipod for english
http://www.site.jp/fr/3-accessories-ipod for french
...

In the worth case put the language variable like this:
http://www.site.jp/en/3-accessories-ipod_en
or something like that

The virtual directory for each language sound great to me.
About localization by search engine my domain name will be in jp and my server is located in the US.

Link to comment
Share on other sites

I guess the best thing would be to have a virtual directory for each language except for the default language like this:
http://www.site.jp/3-accessories-ipod for default language (here japanese)
http://www.site.jp/en/3-accessories-ipod for english
http://www.site.jp/fr/3-accessories-ipod for french
...

In the worth case put the language variable like this:
http://www.site.jp/en/3-accessories-ipod_en
or something like that

The virtual directory for each language sound great to me.
About localization by search engine my domain name will be in jp and my server is located in the US.


In fact cactusman2, I think the problem is even deeper than that.

You say that for SEO reasons, the URL of a product should be different for every language, and you're right. Otherwise, if http://www.site.jp/3-accessories-ipod stays unchanged along the different language versions, Google will see that page differently from a crawl to another.

But I would additionaly say that /en/3-accessories-ipod for english should be /fr/3-accessoires-ipod (in french) for french. The keywords found in the URL are criticaly important for a good SEO. If your keywords appear in english in the URL and in French in the page, than this page won't have good results in GG's listings.

How it should propably work (but correct me if I'm wrong) :

add a virtual directory according to languages

My Product --> /en/my-product

Mon Produit --> /fr/mon-produit

Adding the virtual directory stays useful even if the product title is translated in the URL. As a matter of fact, some product titles will be unchanged between some langauges, but the descriptions won't be the same, and each of them has to be referenced by google under a separate URL.

I'm looking forward to have the Team's point of view about this...

Cheers
Link to comment
Share on other sites

I feel stupid !
I didn't look close enough in the back office. :red:

I have just understood that we can change the product name, even in the URL. Sorry for this !

So, only the last part of my message remains valid: even if we can do that, we need to insert a virtual directory in the URL.

Link to comment
Share on other sites

Hi everyone!

I'm personnaly aware of that issue, I mean multilanguage SEO.

But honestly, right now we're working hard to make the futur 1.1 PrestaShop version very stable and so we won't "care" about such feature before the 1.2 (just like won't add any new feature in the 1.1).

But don't worry we keep in mind that SEO is VERY important, I think with the 1.1 we already proved it, and we'll take care of that discussion for the next versions ;-)

Link to comment
Share on other sites

  • 3 months later...
  • 3 weeks later...

Hi Delart, I've also added my comments to the bug you've reported. The more people do this the higher the change the PS team wil come up with a solution soon. This is an important issue for me as well as I'm selling in a multi-language country (Belgium).

Thanks,

Cosy Planet

Link to comment
Share on other sites

  • 4 weeks later...

Thanks graes0 for your support. I would like to suggest a possible solution. Would it be possible to solve this issue by using another domain and redirecting it to another language of the site (not the default one)? I am really looking forward to avoid another prestashop install in this new domain. Then we would just have to inform google of this new domain, and the new language pages should be indexed. Is this a possible (temporary) solution to this issue?

Thanks!

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 months later...

I discovered this issue last night, and have made a solution for it.

I like the solution with the virtual directory (ex: www.shop.com/en/).

I made a simple solution for Presta v 1.1, with only modification of a few files.

* I changed the rewriterules in .htaccess ( new GET: iso_lang=en|de|fr|etc put not 'js' )
* Changed Tools::switchLanguage ( only commented out $cookie->update() )
* Changed Tools::setCookieLanguage ( here were getting the iso_lang )
* Changed Link.php ( every link should be /iso_lang/rest_of_URL )

Thats it.

[Todo]: Let the gsitemap generate the correct sitemap.xml. Right now they are all pointing to same language!

Below is my code. I did not attach Tools.php as I have made other changes which I won't bother you with.


.htaccess new rewrite rules:

# URL rewriting module activation
RewriteEngine on

# URL rewriting rules
#RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$2$4 [L,E]
#RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$1$3 [L,E]
#RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ category.php?id_category=$1 [QSA,L,E]
#RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ cms.php?id_cms=$1 [QSA,L,E]
#RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ supplier.php?id_supplier=$1$3 [QSA,L,E]
#RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ manufacturer.php?id_manufacturer=$1$3 [QSA,L,E]

# URL rewriting rules
## Now with ...iso_lang/category/product.html
RewriteRule ^([a-ik-zA-Z][a-zA-Z])/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?iso_lang=$1&id;_product=$3$5 [L,E]
RewriteRule ^([a-ik-zA-Z][a-zA-Z])/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?iso_lang=$1&id;_product=$2$4 [L,E]
RewriteRule ^([a-ik-zA-Z][a-zA-Z])/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ category.php?iso_lang=$1&id;_category=$2 [QSA,L,E]
RewriteRule ^([a-ik-zA-Z][a-zA-Z])/content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ cms.php?iso_lang=$1&id;_cms=$2 [QSA,L,E]
RewriteRule ^([a-ik-zA-Z][a-zA-Z])/([0-9]+)__([a-zA-Z0-9-]*)(.*)$ supplier.php?iso_lang=$1&id;_supplier=$2$4 [QSA,L,E]
RewriteRule ^([a-ik-zA-Z][a-zA-Z])/([0-9]+)_([a-zA-Z0-9-]*)(.*)$ manufacturer.php?iso_lang=$1&id;_manufacturer=$2$4 [QSA,L,E]
RewriteRule ^([a-ik-zA-Z][a-zA-Z])/(.*)$ $2?iso_lang=$1 [L,E]

# Catch 404 errors
ErrorDocument 404 /404.php



classes/Tools.php:

    /**
   * Change language in cookie while clicking on a flag
   */
   static public function setCookieLanguage()
   {
       global $cookie;

       /* If language does not exist or is disabled, erase it */
       if ($cookie->id_lang)
       {
           $lang = new Language(intval($cookie->id_lang));
           if (!Validate::isLoadedObject($lang) OR !$lang->active)
               $cookie->id_lang = NULL;
       }

       /* Automatically detect language if not already defined */
       if (!$cookie->id_lang AND isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
       {
           $array = split(',', Tools::strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']));
           if (Validate::isLanguageIsoCode($array[0]))
           {
               $lang = new Language(intval(Language::getIdByIso(strval($array[0]))));
               if (Validate::isLoadedObject($lang) AND $lang->active)
                   $cookie->id_lang = intval($lang->id);
           }
       }

       if (Tools::getIsset('iso_lang') AND !Tools::getIsset('id_lang')) {
           $cookie->id_lang = intval(Language::getIdByIso(Tools::getValue('iso_lang')));
           unset($_GET['iso_lang']);
       }

       /* If language file not present, you must use default language file */
       if (!$cookie->id_lang OR !Validate::isUnsignedId($cookie->id_lang))
           $cookie->id_lang = Configuration::get('PS_LANG_DEFAULT');

       $iso = Language::getIsoById($cookie->id_lang);
       @include_once(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php');
       @include_once(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
       @include_once(_PS_THEME_DIR_.'lang/'.$iso.'.php');
       return $iso;
   }

   static public function switchLanguage()
   {
       global $cookie;

       /* Language switching */
       if ($id_lang = intval(Tools::getValue('id_lang')) AND Validate::isUnsignedId($id_lang))
       {
           $cookie->id_lang = $id_lang;
           //$cookie->update();
           $link = new Link();
           if ($id_product = intval(Tools::getValue('id_product')) AND !isset($_GET['adminlang']))
               $url = $link->getProductLink(new Product($id_product, false, $id_lang));
           elseif ($id_category = intval(Tools::getValue('id_category')) AND !isset($_GET['adminlang']))
               $url = $link->getCategoryLink(new Category($id_category, $id_lang));
           elseif ($id_cms = intval(Tools::getValue('id_cms')) AND !isset($_GET['adminlang']))
               $url = $link->getCMSLink(new CMS($id_cms, $id_lang));
           else
           {
               $n = 0;
               $url = $_SERVER['PHP_SELF'];
               unset($_GET['id_lang'], $_GET['iso_lang'], $_GET['adminlang']);
               foreach ($_GET AS $k => $value)
                   $url .= ((!$n++) ? '?' : '&').urlencode(stripslashes($k)).'='.urlencode(stripslashes($value));
           }
           Tools::redirectLink($url);
       }
   }



Links:
attached [uPDATED] (I attached the wrong Link.php at first... sorry :( )

Link.php

Link to comment
Share on other sites

  • 3 weeks later...

Hi

I see what you are doing: including the iso language code in the mod_rewrite codes in .htaccess, ignoring the cookie updating when changing language, setting the $iso variable containing iso language code, but then in Link.php code I do not see how this $iso variable gets used, the links are same as before, no iso language inserted.

Or did I miss something?

Mike

Link to comment
Share on other sites

Thanks Hessellund !

now you know that somebody actually read your attachment ! :-)))

How do you deal with the home page (no product or category)? Unless I missed something, your solution still has a common index.php page for all languages, right?

Also, o you think it would be possible to use the same techniques to switch between domains (xxxxx.com xxxxx.fr xxxxx.de), instead of switching subdirectories (xxxxx.com/en/ xxxxx.com/fr/ xxxxx.com/de/)?

cheers

Mike

Link to comment
Share on other sites

:-) Nice you read them thoroughly!

You can accomplish quite a lot using rewriterules, so I'm sure you'll be able to figure a way to control language by domain.

If you let apache detect the domainname, and set iso_lang according to it. You will properly need to edit Link.php also.

I actually doesn't deal with the index.php, I only edited the files mentioned above. but www.shop.com/en/ would give you the english version, and so on.

www.alkymea.com has my work implemented.

Link to comment
Share on other sites

Nice site, Hessellund

I am using the latest version 1.2.1, I have adapted your scripts and tested them, they are working.

Attached is the set of 3 modified files
.htaccess
classes/Tools.php
classes/Link.php

Notes on .htaccess :
File contains original content commented out, followed by modified lines.
My site runs on a subdirectory "ecommerce", not at the root, so other userd will have to change .htaccess above either substituting own subdirectory name, or removing "ecommerce/" altogether if in the root.
I have added a redirect to prevent people going to the root (without a language indication) and rerouting to the default "en" version, other users may want to change this.
I have put in five languages in the .htaccess, so please adjust (the original format was intended to prevent "js" requests from being rewritten, but any japanese "jp"site would have also been stopped...).
I also removed all the E flags, they are useless (E flag requires E=xxxxxx nad has no default value according to mod_rewrite specs).

I will try this now at the domain level and see if I can get anywhere, I guess I will have to use RewriteCond to check the domain name called and act accordingly.

I am also looking at removing the .html extension on the products.

fun

Mike

Link to comment
Share on other sites

Attachment is too big.

Here are the changed functions in Tools.php:

   /**
   * Change language in cookie while clicking on a flag
   */
   static public function setCookieLanguage()
   {
       global $cookie;

       /* If language does not exist or is disabled, erase it */
       if ($cookie->id_lang)
       {
           $lang = new Language(intval($cookie->id_lang));
           if (!Validate::isLoadedObject($lang) OR !$lang->active)
               $cookie->id_lang = NULL;
       }

       /* Automatically detect language if not already defined */
       if (!$cookie->id_lang AND isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
       {
           $array = explode(',', Tools::strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']));
           if (Validate::isLanguageIsoCode($array[0]))
           {
               $lang = new Language(intval(Language::getIdByIso(strval($array[0]))));
               if (Validate::isLoadedObject($lang) AND $lang->active)
                   $cookie->id_lang = intval($lang->id);
           }
       }

/* MODIFIECATION : ADDED THIS CODE          */        
       if (Tools::getIsset('iso_lang') AND !Tools::getIsset('id_lang')) {
           $cookie->id_lang = intval(Language::getIdByIso(Tools::getValue('iso_lang')));
           unset($_GET['iso_lang']);
       }
/* END OF MODIFICATION                       */

       /* If language file not present, you must use default language file */
       if (!$cookie->id_lang OR !Validate::isUnsignedId($cookie->id_lang))
           $cookie->id_lang = Configuration::get('PS_LANG_DEFAULT');

       $iso = Language::getIsoById($cookie->id_lang);
       @include_once(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php');
       @include_once(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
       @include_once(_PS_THEME_DIR_.'lang/'.$iso.'.php');
       return $iso;
   }


   static public function switchLanguage()
   {
       global $cookie;

       /* Language switching */
       if ($id_lang = intval(Tools::getValue('id_lang')) AND Validate::isUnsignedId($id_lang))
       {
           $cookie->id_lang = $id_lang;

/* MODIFIED CODE : CODE ADDED HERE                   */
           //$cookie->update();
           $link = new Link();
           if ($id_product = intval(Tools::getValue('id_product')) AND !isset($_GET['adminlang']))
               $url = $link->getProductLink(new Product($id_product, false, $id_lang));
           elseif ($id_category = intval(Tools::getValue('id_category')) AND !isset($_GET['adminlang']))
               $url = $link->getCategoryLink(new Category($id_category, $id_lang));
           elseif ($id_cms = intval(Tools::getValue('id_cms')) AND !isset($_GET['adminlang']))
               $url = $link->getCMSLink(new CMS($id_cms, $id_lang));
           else
           {
               $n = 0;
               $url = $_SERVER['PHP_SELF'];
               unset($_GET['id_lang'], $_GET['iso_lang'], $_GET['adminlang']);
               foreach ($_GET AS $k => $value)
                   $url .= ((!$n++) ? '?' : '&').urlencode(stripslashes($k)).'='.urlencode(stripslashes($value));
           }
           Tools::redirectLink($url);
/* END OF MODIFIED CODE                               */

       }
   }

Link to comment
Share on other sites

Here are the modified parts of Link.php


   public function getIsoLangUrl()
   {
       global $cookie;
       return Language::getIsoById($cookie->id_lang) . '/';
   }



   /**
     * Create link after language change
     *
     * @param integer $id_lang Language ID
     * @return string link
     */
   public function getLanguageLink($id_lang)
   {
       if ($this->allow == 1)
           return __PS_BASE_URI__.''.Language::getIsoById($id_lang).'/';   /* .substr(preg_replace('#/([a-z]{2})/#', '/', $_SERVER['REQUEST_URI']), strlen(__PS_BASE_URI__)); */
       else
           return $this->getUrlWith('id_lang', intval($id_lang));
   }

Link to comment
Share on other sites

In the rest of Link.php , replace all occurences of

$this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.


with

$this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.Link::getIsoLangUrl().


You should make 6 of these changes. Careful, after the first two there are spaces around the ? sign...

For the .htaccess file, below is the modified file (with original text commented out followed by modified rewrites:

# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums

# URL rewriting module activation
RewriteEngine on

RewriteRule ^$ /en/ [R=301,L]

# URL rewriting rules
RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2$3.jpg [L,E]
RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/c/$1$2.jpg [L,E]
#RewriteRule ^lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$3&isolang;=$1$5 [L,E]
#RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2&isolang;=$1$4 [L,E]
#RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$2&isolang;=$1 [QSA,L,E]
#RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2$4 [L,E]
#RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$1$3 [L,E]
#RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1 [QSA,L,E]
#RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1 [QSA,L,E]
#RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /supplier.php?id_supplier=$1$3 [QSA,L,E]
#RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ /manufacturer.php?id_manufacturer=$1$3 [QSA,L,E]
#RewriteRule ^lang-([a-z]{2})/(.*)$ /$2?isolang=$1 [QSA,L,E]

# MODIFIED RULES -allows using form /xx/....... to keep language state in URL
RewriteRule ^(en|fr|es|it|de)/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?iso_lang=$1&id;_product=$3$5 [L]
RewriteRule ^(en|fr|es|it|de)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?iso_lang=$1&id;_product=$2$4 [L]
RewriteRule ^(en|fr|es|it|de)/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?iso_lang=$1&id;_category=$2 [QSA,L]
#RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2$4 [L]
#RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$1$3 [L]
#RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1 [QSA,L]
RewriteRule ^(en|fr|es|it|de)/content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?iso_lang=$1&id;_cms=$2 [QSA,L]
RewriteRule ^(en|fr|es|it|de)/([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /supplier.php?iso_lang=$1&id;_supplier=$2$4 [QSA,L]
RewriteRule ^(en|fr|es|it|de)/([0-9]+)_([a-zA-Z0-9-]*)(.*)$ /manufacturer.php?iso_lang=$1&id;_manufacturer=$2$4 [QSA,L]
RewriteRule ^(en|fr|es|it|de)/$ /index.php?iso_lang=$1 [L]
RewriteRule ^(en|fr|es|it|de)/(.*)$ /$2?iso_lang=$1 [L]

# Catch 404 errors
ErrorDocument 404 /ecommerce/404.php



That sums up Hessellund's useful modification (only 2 core files and the .htaccess fileto change!) adapted now to version 1.2.1 - hope it helps somebody.

Mike

Link to comment
Share on other sites

  • 3 weeks later...

Nice workaround!

Just one question: once I do this modification, the URLs without the additional virtual library (/en) will still be working for the default language, right?

I want to add different languages to the shop without losing the existing references in inbound links.
And I need this workaround to have the other language pages indexed by google.

Link to comment
Share on other sites

Yes, without the virtual directory (/en) the language i chosen by default language or if a cookie was set by the customers chosen language.

But all links in categories etc. will point to shop.tld/en/url...

And yes I made the "workaround"/feature/enhancement to let google index all languages.

Small bugfix by the way:
in Tools.php please comment out the unset command like this:

// unset($_GET['iso_lang']);



This is to fix google indexing of product descriptions (due to a bug in product.php actually!)

Link to comment
Share on other sites

I've tried the workaround, but it didn't work for me.
I get 404 pages for the product pages, and the URL is unchanged.

I also had to implement this workaround for another problem:
http://www.prestashop.com/forums/viewthread/16130/general_discussion/problem_with_friendly_url

Since it's another change to Link.php, I suspect that it interferes with your solution.

I also have a www -> non-www rewrite rule in my .htaccess file that might be a problem.

Any idea about what could be the problem here?

THanks

Link to comment
Share on other sites

Sure it might be some interference with multiple bugfixes in a row.

Google for apache's docs on rewrite engine, to understand what is going on.

My enhancement (its not a workaround) should convert /en/ to ?iso_lang=en and so forth. (This is done via .htaccess)

Tools.php is responsible for setting the language according to the iso_lang variable.

Link.php should generate urls all starting with /en/ or whatever iso-language is currently used.

Hope you figure it out.

Link to comment
Share on other sites

After analyzing the changes, I've found that the 2 enhancements interfere indeed.
Using both, Line 44-46 in Link php should look like this:

if (is_object($id_product))
           return ($this->allow == 1)?(_PS_USE_SSL_.__PS_BASE_URI__.Link::getIsoLangUrl().($category ? ($id_product->category.'/') : '').intval($id_product->id).'-'.$id_product->link_rewrite.($id_product->ean13 ? '-'.$id_product->ean13 : '').'.html') : 
           (_PS_USE_SSL_.__PS_BASE_URI__.'product.php?id_product='.intval($id_product->id));



This way the virtual library (/en/) is added to the URL, but I still get 404 pages for both products and categories :(

I'll try to figure out what else could be the problem.

Link to comment
Share on other sites

I think the problem's gonna be with the htaccess file.
I've noticed that my URL structure is domain/product, while yours is domain/category/product which could be the issue.

I just need to understand the regular expressions better to see exactly what is happening.
How should the lang cookie exactly appear in the URL? (It's not clear for me from the rewrite)

Thanks

Link to comment
Share on other sites

One more thing. This way the old product and category URLs were not working, so I've uncommented the first 3 old rewrite rules, and now everything seems to be fine.


I was wrong here, this results in all pages displayed in default language again. Need to find another solution to maintain the original product links as well.
Link to comment
Share on other sites

  • 5 months later...
  • 4 weeks later...

I have two-language shop (1.2.5). Each product has unique url and meta tags for both languages. In sitemap:

Estonian (default lang):
http://www.nordoutlet.com/meeste-t-sargid-armani/1456-armani-t-sark.html
Russian:
http://www.nordoutlet.com/lang-ru/muzhskie-futbolki-armani/1456-armani-futbolka.html

Now in Google the rus result for the product is without /lang-ru/ in the url and the title and desc are in estonian. But I need the title and desc. to be in appropriate language in the Google.

How is 1.2.5 working fine with multiple languages?

Link to comment
Share on other sites

  • 2 months later...
I have two-language shop (1.2.5). Each product has unique url and meta tags for both languages. In sitemap:

Estonian (default lang):
http://www.nordoutlet.com/meeste-t-sargid-armani/1456-armani-t-sark.html
Russian:
http://www.nordoutlet.com/lang-ru/muzhskie-futbolki-armani/1456-armani-futbolka.html

Now in Google the rus result for the product is without /lang-ru/ in the url and the title and desc are in estonian. But I need the title and desc. to be in appropriate language in the Google.

How is 1.2.5 working fine with multiple languages?


I did not fully understand this issue, since on my own shop, the URLs are the same for the multiple languages.

I have just posted a solution for this issue at http://www.prestashop.com/forums/viewthread/55895/

It keeps the lang-xx in all the URLs (except the default language) which will make them open up in the correct language.
Link to comment
Share on other sites

  • 1 month later...

HI

I made this solution for fixing the lang problem but the url looks pretty bad in /56-dogs.html

Can these things be implemeted in .htacces

WEBSITE/lang/category/subcategory/productname.html

lang = This is the language 2 letter words for example de,es,fr,it,en
category = the category which holds the current subcategory ( If user on this category then only show /de/dogs/)
subcategory = the category under the CATEGORY above (for example /de/dogs/toys/ )
productname = the exact product name from presta without any id or ean numbers in it

I would really appriaate anyone pointing me to the right direction

Thanks a lot

Link to comment
Share on other sites

  • 2 months later...

Agree with poplol, I would like to have this too...specially if switching to another language really works...
Currently this is not working in my shop and it's driving me crazy. Perhaps if the solution ealier mentions and widely spoken off is the best solution can anyone rewrite it structured and working for the last version?

I have read the topic multiple times now...but I'm gettng lost in this wave of codes...completely lost where to what and why...

Link to comment
Share on other sites

×
×
  • Create New...