?
avatar smanzi
smanzi
3 Sep 2014

Steps to reproduce the issue

Install a multilingual site, primary en-GB, secondary whatever (e.g. it-IT), with some menu item "associated" across the two languages
Set en-GB as default language
Publish the "Language Switcher" module in a visible position
In the "Language Filter" system plugin set "Remove URL Language Code" to "Yes"
Navigate to the secondary language home page (e.g. http://example.com/it)

Expected result

The language switcher URL for the English "side" should be "http://example.com/"

Actual result

The language switcher URL for the English "side" is "http://example.com/en"

System information (as much as possible)

PHP Built On Linux 3.2.58-grsec.31.el5 #1 SMP Tue May 13 08:10:54 EDT 2014 x86_64
Database Version 5.1.67-rel14.3-log
Database Collation utf8_general_ci
PHP Version 5.3.28
Web Server Apache
WebServer to PHP Interface cgi-fcgi
Joomla! Version Joomla! 3.3.3 Stable [ Ember ] 25-July-2014 13:00 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT

Additional comments

This is true for every associated menu item:
If I have /test (en-GB) associated with /it/prova (it-IT) and I go to http://example.com/it/prova, the associated URL in the Language Switcher is http://example.com/en/test instead of http://example.com/test.

This generates unneeded "303 See Other" HTML errors and screw-up automatic sitemap generator services

avatar smanzi smanzi - open - 3 Sep 2014
avatar smanzi smanzi - change - 3 Sep 2014
The description was changed
avatar smanzi smanzi - change - 3 Sep 2014
Category Multilanguage
avatar brianteeman
brianteeman - comment - 3 Sep 2014

Please go to the module manager -> filter to show the admin modules and publish the module called Multilingual Status and check that there are no errors

avatar smanzi
smanzi - comment - 3 Sep 2014

Confirmed: no issue detected by Multilingual Status

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar brianteeman
brianteeman - comment - 3 Sep 2014

Sorry but I cannot replicate this - did you make sure that you correctly
set the language for the individual menu items

On 3 September 2014 17:37, Sergio Manzi (smz) notifications@github.com
wrote:

Confirmed: no issue detected by Multilingual Status

This comment was created with the J!Tracker Application
https://github.com/joomla/jissues at
http://issues.joomla.org/http://issues.joomla.org/
http://issues.joomla.org/.


Reply to this email directly or view it on GitHub
#4215 (comment).

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar smanzi
smanzi - comment - 3 Sep 2014

Absolutely: every menu item is correctly associated with the corresponding item in the "other" language.
Live example is available at http://nuovaicona.org: look at the URLs in the Language Switcher flags (top-right)


This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar brianteeman
brianteeman - comment - 3 Sep 2014

Just tested your site and all the menu links worked perfectly for me
All english urls are without the /en and all italian urls are with the /it

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar smanzi
smanzi - comment - 3 Sep 2014

Hi Brian, and thank-you for testing.
Yes, all menu entries are absolutely correct.
The problem (as per this tracker title) is with the URL generated by the "Language Switcher" module for associated menu entries: go to an Italian page, position your mouse pointer over the UK flag in the language switcher and look (Firebug or if Firefox status) the URL there. They all have the /en/

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar brianteeman
brianteeman - comment - 3 Sep 2014

Yes but when you click on them the /en is not used. Thts the way the code
works

On 3 September 2014 19:41, Sergio Manzi (smz) notifications@github.com
wrote:

Hi Brian, and thank-you for testing.
Yes, all menu entries are absolutely correct.
The problem (as per this tracker title) is with the URL generated by the
"Language Switcher" module for associated menu entries: go to an Italian
page, position your mouse pointer over the UK flag in the language switcher
and look (Firebug or if Firefox status) the URL there. They all have
the /en/

This comment was created with the J!Tracker Application
https://github.com/joomla/jissues at
http://issues.joomla.org/http://issues.joomla.org/
http://issues.joomla.org/.


Reply to this email directly or view it on GitHub
#4215 (comment).

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar smanzi
smanzi - comment - 3 Sep 2014

no, if you click there, the /en/ URL is used. Then you get a 303 HTML error and are redirected to the correct page.
This is not a big problem per se, except for spiders that try to access also the /en/ version of each page.
In any case I think the "Language Switcher" module should generate the very same canonical URLs that are generated by the Menu Module...

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar brianteeman
brianteeman - comment - 3 Sep 2014

Sorry but I can NEVER get to URL with /en it is always redirected
On 3 Sep 2014 20:02, "Sergio Manzi (smz)" notifications@github.com wrote:

no, if you click there, the /en/ URL is used. Then you get a 303 HTML
error and are redirected to the correct page.
This is not a big problem per se, except for spiders that try to access
also the /en/ version of each page.
In any case I think the "Language Switcher" module should generate the
very same canonical URLs that are generated by the Menu Module...

This comment was created with the J!Tracker Application
https://github.com/joomla/jissues at
http://issues.joomla.org/http://issues.joomla.org/
http://issues.joomla.org/.


Reply to this email directly or view it on GitHub
#4215 (comment).

avatar smanzi
smanzi - comment - 3 Sep 2014

yes, as I said you are redirected, but there are spiders out there that do index the /en/ version too.

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar smanzi
smanzi - comment - 3 Sep 2014

I'm afraid there is more, and this is not related to the Language Switcher:

In the "other language" side (Italian in my case), the rel="alternate" links that are put into the <head> section have the /en/ part in them. So we indicate as "alterante" an URL which then gives a 303 error and I think this is a bad-bad-thing for SEO

I'm unsure if this need a separate tracker...

PLEASE NOTE: the example URL I gave above (http://nuovaicona.org) does not present these issues anymore as I've applied a quick-and-dirty hack (thanks to ReReplacer!). If you want to see the issues go to http://test.nuovaicona.org

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar infograf768
infograf768 - comment - 4 Sep 2014

The "problem" is a known side-effect when removing the url language code for the site default language.
A 303 is not a fatal error, it just indicates a redirection.
What kind of "hack" have you done?

avatar smanzi
smanzi - comment - 4 Sep 2014

Jean-Marie (and Brian), you are absolutely correct that "the problem" does not involve a lack of functionality and that everything, in a way, "works" and thus this cannot be considered a "major problem", but I hope you'll forgive me if insist that this should be somehow fixed (and if you point me in the right direction I can give a look and see if I can find a solution and propose a PR).

In my case it is really a minor problem as my site is a very tiny one, but imagine a multilingual site made of thousand of pages: for every spider's run 2x HTTP requests will be made and 2x HTTP responses will have to be generated.

Beside that, I have factual evidence that at least two of the most used on-line sitemap generators do generate URLs that points to the "wrong" URLs. Yes, it can be a in issue of those generators too, but anyway I still think that declaring as rel="alternate" URLs giving a redirection is not correct and may (I have no factual evidence of this) be somehow punished by search engines (any insight by a SEO expert will be appreciated)

Jean-Marie, the hack has been using the (fantastic!) NoNumber ReReplacer plugin, setting up a regular expression that modify every "href=" URL containing the /en/ string to the corresponding one without the /en/ string.

Thanks and regards,

Sergio (aka smz)

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar infograf768
infograf768 - comment - 4 Sep 2014

I do not advise to make a native multilanguage site for a huge site.
And in fact, when using associations, I always suggest to not remove the language code at all.

To try to solve the issue you will have to look into the languagefiler.php (not mod_languages)
https://github.com/joomla/joomla-cms/blob/staging/plugins/system/languagefilter/languagefilter.php

the code for the rel is from line 624

avatar smanzi
smanzi - comment - 4 Sep 2014

Jean-Marie, thanks for the hint.

Looking at the code it seems to me that the "$link" part of the "alternate" links is built by JRoute, so a fix it should be probably applied there (which will open a cans of worms...). BTW, I hope Hans Pappenberg is following this tracker, as it can have implications on his current work on the router.

A possible solution could be to "fix" the $link for the default language in languagefiler.php. This should anyway be subject to the conditions that the "remove language code" option has been chosen and, we are using SEF URLs, and, of course, only for the default language. What do you think?

Thanks!

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar smanzi
smanzi - comment - 4 Sep 2014

hmmm... fixing the way I described will solve the issue for the "alternate" links, but will not solve the one with the "Language switcher", which albeit even a minor one is still an issue and will "trick" spider to go to un-canonical URLs, so the correct solutions would probably be to fix the links right in the router, where they belong...

What puzzles me is, how does it happens that links in the menu system are correct, without the /en/ or whatever is the default language code, while all the others are (half)broken?

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar infograf768
infograf768 - comment - 4 Sep 2014

Will propose a PR for the alternate tomorrow in languagefilter.

avatar smanzi
smanzi - comment - 4 Sep 2014

That's great news! Merci beaucoup, Jean-Marie!

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar eck340
eck340 - comment - 4 Sep 2014

Hi guys,

I am on joomla 2.5 and I have the same issue as smanzi.

But I would like to know how did you make it work with ReReplacer ?

I installed it but Im not sure how to configure it and what to type in.

Can you explain me what to do or give me your Skype ?

Thanks

avatar smanzi
smanzi - comment - 5 Sep 2014

This is probably not the right place for this, but...

  • in ReReplacer create a new substitution
  • assign it a Title (eg. Fix default language URLs)
  • set "Regular Expressions" to Yes
  • in "Search" type: href="(http://www.example.com/|/)(en/)
  • (in the above, of course substitute www.example.com with your domain and "en" with your default language code)
  • in "Replace" type: href="\1
  • important: in the "Search areas" options set "Enable in area" to Everywhere
  • set "Published" to "yes"
  • Save & Close
  • Done!

Please note: the above is tested with Rereplacer 5.11.1 Pro: I'm unsure if the free version gives you all the required options...

In any case my advice is to wait for an official fix and, if you wish, contribute back by testing it.

Cheers!

smz

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar smanzi
smanzi - comment - 5 Sep 2014

OUCH! Wait a minute... I just realized that the above trick works for me because I have all aliases in Italian which are different from the aliases in English and... it doesn't work for the home page (you can't switch from the secondary language to the primary while you are in the home page).

So, forgive fixing the language switcher and just substitute:

href="http://www.example.com/en with href="http://www.example.com/
Regular expression not needed in this case.

This will fix the "rel=alternate" links only

Jean-Marie... this is something to think about... :-/

Sergio

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar smanzi
smanzi - comment - 5 Sep 2014

in the previous read "forget fixing" instead of "forgive fixing"

Aren't comments editable?

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar eck340
eck340 - comment - 5 Sep 2014

Hi smanzi, Thank you for your help. My default language is French and my secondary language is English. So my aliasses are different too.

[important: in the "Search areas" options set "Enable in area" to Everywhere]

I should not put in the Header only instead ?

I dont have the pro version but I will try if it work anyway.

Im not sure what you mean by it doesn't work for the home page.

Thanks

avatar eck340
eck340 - comment - 5 Sep 2014

Everything work fine as you told me to do ! It's awesome but now my home page is broken... All the other page work fine but when I am on my english homepage and I want to go to my French Default Homepage since the /fr/ is removed it doesnt work. when I click on it it's stay on the English Home Page.

Any way of fixing the homepage while keeping the other pages this way ?

avatar smanzi
smanzi - comment - 5 Sep 2014

Exactly, that what I said: "fixing" the language switcher does break the possibility to go back to your default language in the home page (and, I think, in every page where the aliases for the two languages are the same, but this must be tested...).

So, just apply only the fix for the "rel=alternate" links and, yes, in this case Search Area = Header is enough.

But... let's get out of here before someone shoots at both of us! :-/ my e-mail is smz(at)smz.it

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar eck340
eck340 - comment - 5 Sep 2014

The second method is not working for me. the rel=alternate still have the language tag in the URL.

I put excatly this in Search box : href="http://www.example.com/fr
and excatly this in replace box : href="http://www.example.com/
Search Options all tick to No
Search Area : Head (not in body)
Enable in Feeds and Admin : No

I dont know what I did wrong.. but it doesnt replace the link.

Email Sent.

avatar infograf768 infograf768 - reference | - 5 Sep 14
avatar infograf768
infograf768 - comment - 5 Sep 2014

Please test #4221 and confirm in the PR (this is for 3.x)

avatar brianteeman brianteeman - change - 5 Sep 2014
Status New Confirmed
avatar infograf768
infograf768 - comment - 5 Sep 2014

Just thinking that we maybe should not do it for the home page as it could lead to confusions :
The language code taken out would let the url redirected to Browser Settings or Default site, depending on the language filter settings. Default site would be fine, but browser settings would not.

What do you think?

avatar infograf768
infograf768 - comment - 5 Sep 2014

I closed the PR
Please Read #4221 (comment)

avatar smanzi
smanzi - comment - 5 Sep 2014

Jean-Marie,
Sorry, I will not have the time to test the PR before later this afternoon/evening (CET).
I'm unsure of what you mean when you say that "The language code taken out would let the url redirected to Browser Settings or Default site": How can you be redirected to Browser Settings? ... I think I will understand what you mean when I'll test your PR... sorry but I just don't have the time right now.

I see you closed the PR on the ground that "if I'll ever change my default language later, then URLs without the language code indexed by search engines will point to the wrong language". I do not agree for the following reasons:

  • Search engines will eventually re-crawl the affected pages and index the new content
  • Changing the default language of a live site is a bad-bad-thing
  • If you think you'll ever need to do that, just do not set the "Remove URL Language Code"

    This comment was created with the J!Tracker Application at http://issues.joomla.org/.
avatar eck340
eck340 - comment - 5 Sep 2014

Hi Jean-Marie,

I totally agree with smanzi.

But Is it possible to have a PR for Joomla 2.5 ?

Thanks

avatar smanzi
smanzi - comment - 5 Sep 2014

Jean-Marie,
I'm testing your PR on http://test.nuovaicona.org and so far it seems to me that it works like charm!

I think I've got what you meant when you were talking about "Browser Settings". I have indeed set up my test site with "Default Language"=English and in Language filter I've set "Language selection for new visitors"="Browser Settings": if I go to the naked domain using an Italian browser I'm redirected to http://test.nuovaicona.org/it, which is expected. If I use an English browser I'm not redirected. In both cases I can switch language using the Language switcher and rel="alternate" links seems to be consistent. Not sure what will happen using another (eg. French) browser: what I expect is it to go to the default language (English). Have you a French browser at hand and can you please make a quick test?

I don't see any problem at all...


This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar smanzi
smanzi - comment - 5 Sep 2014

P.S.: I've originally opened this tracker focusing on the "Language switcher" that, after all, is probably a non-issue. If someone from the JBS wants to change the title to something else reflecting the fact that the main issue are the rel="alternate" links, I'll have (of course) no objection to this...

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar eck340
eck340 - comment - 5 Sep 2014

Hey smanzi I tested you website with my french browser and the website is in english. no redirect only naked domain.

For my side, I dont know why but when I am in google web master and do a fetch as google and render. The google spyder do not fetch the rel=alternate link..

It is not showing up in the source code of the result. But if i go to my website with my browser i am able to see it.

avatar smanzi
smanzi - comment - 5 Sep 2014

@eck340
Googlebot fetch correctly for me... Check the date/time of when it was fetched: was it that after you applied the patch? Try re-fetching.

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar infograf768
infograf768 - comment - 6 Sep 2014

Please comment on the PR, not here.
#4221

I had already prepared a PR for 2.5, but, as I said, I am not convinced anymore we should merge these.
One solution would be to add a new parameter set to NO to be B/C.
I guess we need an SEO expert here.

avatar smanzi
smanzi - comment - 6 Sep 2014

@infograf768
OK: I've commented on #4221, although it is a closed tracker...

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar eck340
eck340 - comment - 6 Sep 2014

I dont know why but google is still indexing some of my page with /fr in the url. even though I did the modification with the plugin.

I dont know what to do.

the /fr is removed in the header with the alternate tag but it is not removed below for language switcher module.

avatar infograf768
infograf768 - comment - 7 Sep 2014

@eck340
Please, again, post on #4221

avatar brianteeman brianteeman - change - 23 Sep 2014
Category Multilanguage Plugins
avatar infograf768
infograf768 - comment - 2 Oct 2014

Please test on 2.5.x this new PR
#4425

avatar infograf768 infograf768 - change - 28 Oct 2014
Status Confirmed Fixed in Code Base
avatar infograf768 infograf768 - close - 28 Oct 2014
avatar zero-24 zero-24 - close - 28 Oct 2014
avatar infograf768
infograf768 - comment - 28 Oct 2014

Alternate have been solved in 3.x as well as 2.5. Closing. Thanks

This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4215.

avatar infograf768 infograf768 - change - 28 Oct 2014
Closed_Date 0000-00-00 00:00:00 2014-10-28 07:20:07
avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?

Add a Comment

Login with GitHub to post a comment