? Success

User tests: Successful: Unsuccessful:

avatar infograf768
infograf768
17 Nov 2014

See wrong PR here (because the true is not placed where it should) and discussion: #5092

Test instructions, set a multilanguage site with en-GB as default site
1. Remove URL Language Code is set to YES in the language filter
2. Language to display will be the default site language. Note it.
3. Search Engine Friendly URLs is set to Yes in Global configuration

When hovering on the language switcher module to get to the default site language, copy the link
It will be of the type http://mysite.com/en/ (if en-GB is the default site language)

Open this online checker: http://redirectdetective.com/
Enter the link you just copied. See results.
=>303 redirect
Apply patch, and test again the same link in http://redirectdetective.com/
=> 301 redirect


Here is a live example of a site where the patch has been applied:
Go to:
http://info-graf.fr/multi/fr/blog-fran%C3%A7ais-%C3%A5-tester/2-article-fr-fr.html

Hover the English flag of the language switcher.
The link is http://info-graf.fr/multi/en/home-en-gb/8-category-en-gb/1-article-en-gb.html
Copy the link in http://redirectdetective.com/ and Trace url.
It will show that the redirect is a 301

avatar infograf768 infograf768 - open - 17 Nov 2014
avatar jissues-bot jissues-bot - change - 17 Nov 2014
Labels Added: ?
avatar infograf768 infograf768 - change - 17 Nov 2014
The description was changed
avatar fontanil
fontanil - comment - 17 Nov 2014

@test
Patch works well for me. Thanks!

avatar lunalars
lunalars - comment - 17 Nov 2014

@test
Success if "Remove URL Language Code" is set to "YES" (with and without SEF enabled in global config)

avatar infograf768
infograf768 - comment - 17 Nov 2014

Looks like you are confusing SEF and SEF rewriting. :)
I guess you meant SEF rewriting on or off. Right?

avatar ManuxGR
ManuxGR - comment - 17 Nov 2014

I have already test this, it's working for both cases "remove language code from url" set to "yes" or set to "no"

avatar lunalars
lunalars - comment - 17 Nov 2014

@infograf768
Oh, yes :-)
Just checked again, and test is still successful.

avatar ManuxGR
ManuxGR - comment - 17 Nov 2014

I will post back as soon as i have the duplicated content fixed. Right now i have about 350 duplications.

301 is working properly since 2 days. Probably in about 2 weeks they are going to be fixed.

avatar infograf768
infograf768 - comment - 17 Nov 2014

I have already test this, it's working for both cases "remove language code from url" set to "yes" or set to "no"

In the last case there is no redirect indeed

avatar ManuxGR
ManuxGR - comment - 17 Nov 2014

You are right once again.
I forgot i had also add "true" to line 315 and 320.

avatar Hackwar
Hackwar - comment - 17 Nov 2014

why are you doing the whole $uri->base().$uri->toString(array()) stuff? $uri->toString() would be the same...

avatar infograf768
infograf768 - comment - 17 Nov 2014

@Hackwar
This is not the issue here. Some code comes from 1.6. beta and I am sure it can be modernised/corrected.
Let's separate issues please.

avatar smanzi
smanzi - comment - 17 Nov 2014

@infograf768 Tested:

Condition are:

  • browser en-US
  • default site language: it-IT
  • secondary site language: en-GB

1st interaction. Being already in the Italian site go to another page:
1

2nd interaction. Language Switcher to English:
2

3rd interaction. Language Switcher back to Italian:
3

4th interaction. Login with user associated to en-GB:
loggin-in

4th interaction. Language switcher to Italian:
logged-in-to-other

avatar infograf768
infograf768 - comment - 17 Nov 2014

Good find!
This means we also have to send a 301 when the user logs in and has the default site language as own language, right?

avatar smanzi
smanzi - comment - 17 Nov 2014

Well... it is more the 5th that concerns me from an architectural point of view (303 for a user logging in and being redirected is totally OK).
4th and 5th are a non-issue SEO-wise (spiders do not log-in, hopfully...), but IMHO and really without the minimal intention to offend, everything here speak "bad implementation", and I'm not talking about this PR: something is wrong ab initio, I think. Again, do not take this personally this is not my intention.

avatar infograf768
infograf768 - comment - 17 Nov 2014

I did not get the 5th one here. Just the 303 when user logs in. When switchinh back to the default language I have a 301

avatar infograf768
infograf768 - comment - 17 Nov 2014

Concerning the implementation:
The functionnality was not designed to be used without language code at the origin.
But people kept asking for it and we did our best...

avatar smanzi
smanzi - comment - 17 Nov 2014

OOPS... that's strange... How can this be?
If you want I can try to replicate in the on-line version of my test site and give you admin rights...

avatar infograf768
infograf768 - comment - 17 Nov 2014

I am using Tamper Data addon for Firefox to trace this.

avatar Hackwar
Hackwar - comment - 17 Nov 2014

@smanzi fully agree with you here. Having 7 $app->redirect()s in the parse rule with mostly the same code looks pretty bad. Likewise with half a dozen checks if self::$sefs[$sef]. Simply said, this code is so complex, that I have huge difficulties reading/understanding it. Equally with imploding the array at one point and concatenating strings at the other point.

avatar smanzi
smanzi - comment - 17 Nov 2014

My screenshots are from the native Firefox inspector, Network view: try with that...

avatar smanzi
smanzi - comment - 17 Nov 2014

@Hackwar pfuiiii.... you make me feel a bit less dull: I broke my head trying to get a grasp of it!

avatar infograf768
infograf768 - comment - 17 Nov 2014

@Hackwar
Apart your mistake above in the code suggestion, you should very well remember which were the conditions Christophe and I had to deal with to force this minimal implementation of multilinguism in Joomla 1.6 and upper.

Evidently, the base is flawed!

This series will NOT provide a Joomla multilingual for big sites. It is a well known fact.

We were told to wait for the UCM, etc. to get a real multilingual Joomla!. I.e. was to be for version 3....
You very well know where ucm is now... Yeah, deep in it.

I have fought since I co-founded Joomla! for languages and multilanguage.
And I was very much alone until Christophe came with the code abilities, as we had nobody else volunteering... including yourself.
Then we happily had bembelimen who extended the associations.

Apart from these 3, no one has worked on it deeply. No one. We have simply corrected and improved on the base we had to be B/C and I had to always beg to get testers.

This PR is a little improvement for those who care for SEO.

avatar infograf768
infograf768 - comment - 17 Nov 2014

@smanzi
I confirm 5. when switching to the default language I have a 301 (Firefox Inspector)

avatar smanzi
smanzi - comment - 17 Nov 2014

@infograf768 OK, I will re-test, try to replicate on-line and then get in touch with you...

avatar Hackwar
Hackwar - comment - 17 Nov 2014

JM, I'm not saying that your work is not appreciated or that what you are trying to achieve is wrong. Quite the contrary. But I'm saying that when you are going to invest work into this, then please make it right and rewrite this plugin. I'm more than happy to help you out with this, but to be able to help you, I need to be able to understand what it is that you are trying to achieve with that plugin. The way the code is written, that is not possible right now, since it simply is too complex.

As you rightly said, UCM is dead. But I don't see why we couldn't get a proper multilang implementation in 3.x. And you know very well that I have to beg for every test and change as well.

avatar smanzi
smanzi - comment - 17 Nov 2014

@infograf768 I confirm I have both 303 and 301 also with my on-line test site.

You can check at:

If you wish, just tell me and I'll send you credentials for admin/FTP/cPanel

avatar smanzi
smanzi - comment - 17 Nov 2014

... there is also an Akeeba Backup .jpa file to download, if you prefer...

avatar smanzi
smanzi - comment - 18 Nov 2014

@infograf768
Well, you know something? We are both right!
It seems to depend from the fact if you have already switched language in your state - either not-logged-in or logged-in.

If you want to conistently see my behavior, after (or even before!) point 5 click again on the flag of the same language you are already into: then you will start seeing 303 + 301

Something similar happens also on the home page even for not logged-in users:

Starting with a fresh (no cookie) browser:

  1. go to the home page: GET
  2. switch to other language: GET
  3. back to default language: 301 + GET
  4. again to other language: GET
  5. again back to default language: 303 + GET
avatar smanzi
smanzi - comment - 18 Nov 2014

Some more info. Even for not logged in users:

  1. go to some (not home) page: GET
  2. switch to other language: GET
  3. back to default language: 301 + GET
  4. again to other language: GET
  5. again back to default language: 303 + 301 + GET
avatar smanzi
smanzi - comment - 18 Nov 2014

May it be possible that everything derives from the need of having (explicitly for NON-SEF, implicitly for SEF) the lang=xx parameter on the URI, even for the default language?

If without SEF enabled I go to the home page I get this:

GET http://example.com/
303 -> http://example.com/index.php?lang=it

Now think of this: if we modify the rules of the game and we say: we levy the need of the lang parameter and if it is missing from the NON-SEF URL we just serve the default language?
At the same time we should also alter a little bit the code of the Language Module.

In Language Module:

add a "?switchlang=xx" parameter to every URI in the "flags" (both SEF or NOT SEF)

in languagefilter:

if (we have the switchlang param set)
{
    set the cookie for it
    remove it from the URI
}


if (the lang=xx parameter or /xx/ is present)
{
    honour it, serve the page and be happy
}
else // no lang
{
    if (this is the home page)
    {
        if (the cookie is set && cookie != default language)
        {
            redirect 303 to the correct language home page (with &lang=xx or /xx/, depending on SEF)
        }

        serve the default lang home page
    }
    else // no lang, not the home page
    {
        if (SEF && !remove_default_language_code)
        {
            T.B.D.: probably just a 404 or a 301 to the page with /xx/, maybe according to a new option
        }
        serve the default language page
    }
}

Everything seems to me to be B/C too...
Am I missing some point?

avatar smanzi
smanzi - comment - 18 Nov 2014

the switchlang=xx parameter should also be added to the login logic...

avatar infograf768
infograf768 - comment - 18 Nov 2014

@smanzi:
Ref: #5129 (comment)
I still do not get any 303, even on your site.
Also it does not look like you have set up a vanilla site and added this PR as, when hovering the links on the switcher for the default site language, the link does not contain the lang prefix

avatar infograf768
infograf768 - comment - 18 Nov 2014

@smanzi
my skype is infograf768

Let's share screen there and I will show you

avatar stellainformatica
stellainformatica - comment - 18 Nov 2014

@test
The patch works as expected, with the patch applied I see now a 301 redirect
screen shot 2014-11-18 at 11 10 32

avatar smanzi
smanzi - comment - 18 Nov 2014

@infograf768
Jean-Marie, I'm getting 303 + 301 on your site too (for English page)... then It must be something else: browser?

My site is stock 3.3.6 with the following exceptions:

  • Installed Akeeba Backup
  • Installed com_patchtester
  • Installed a content plugin of mine that does markdown parsing

I'm going to open Skype later (about 1 hour...) Don't you have TeamViewer for screen sharing? I normally use that... never tried with Skype...

avatar smanzi
smanzi - comment - 18 Nov 2014

capture

avatar smanzi
smanzi - comment - 18 Nov 2014

On Jean-Marie site try switching between fr-FR and en-GB several times: at one point it start issuing 303 as well. Once started it does consistently. At least, this is what I'm seeing here: if nobody else has this problem it must be something local on my PC (Windows 8.1, Firefox 33.1)

avatar infograf768
infograf768 - comment - 18 Nov 2014

I think we are going to merge this as we have already many positive tests and you are the only one to get a 303 for current navigation.
Getting two 3xx redirects before the 200 is anyway weird. I have never seen that on the web,
(BTW, all tests should be done on staging, not on 3.3.6)

I am on skype right now if you want to see here what goes on

avatar ManuxGR
ManuxGR - comment - 18 Nov 2014

Sorry but i can not follow sometimes, it gets complicated for me. But if you need any help testing or an opinion let me know.
Anyway, my skype is manos-sx feel free to add me and ask for help.

avatar smanzi
smanzi - comment - 18 Nov 2014

@infograf768
Hi Jean-Marie: sorry but I've been out for a while...

I think we are going to merge this as we have already many positive tests and you are the only one to get a 303 for current navigation.

As you wish, but as I told you in the other PR I have other concerns about having many links generating 301 on a site and namely:

  • Is this going to have a SEO impact?
  • Is this going to create problems to sitemap generators?
  • Will this litter my Webmaster Tools?

Getting two 3xx redirects before the 200 is anyway weird. I have never seen that on the web,

I trust you, but as you've probably seen on my last screenshot I'm getting those also on your site...

I will probably be on-line later if... I don't have to rush to the hospital: kidney stones are haunting me since a couple of days :anguished:

avatar Hackwar
Hackwar - comment - 18 Nov 2014

Providing a bunch of improvements to the languagefilter plugin: #5135

avatar lunalars
lunalars - comment - 19 Nov 2014

I think i found a way to reproduce the 303s ...
Tested on Ubuntu 14.04 with Firefox 33.0 (Firebug and Firefox Dev Tools) and Chromium 38 (Dev Tools).

First clear browser cache and then go to http://info-graf.fr/multi/

In Firefox switch to italian, french, italian, english (301), italian, french, italian, english -> 303 and you are still on italian.

In Chromium i had to go through this cycle one more time and on the last switch to english i get 301 + 303 and am still on italian.

Now deactivate caching in Firebug and Chromium Dev Tools (didn't find a way for Firefox Dev Tools) and try again: all should be fine (no more 303).

So maybe the question is: do crwlers use cache?

avatar infograf768
infograf768 - comment - 19 Nov 2014

I guess that rawlers do not use your browser, therefore not the browser cache.

avatar infograf768
infograf768 - comment - 19 Nov 2014

This patch is now included in Hannes PR #5135

avatar infograf768
infograf768 - comment - 20 Nov 2014

#5135 includes this code. Closing.

avatar infograf768 infograf768 - close - 20 Nov 2014
avatar infograf768 infograf768 - change - 20 Nov 2014
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-11-20 07:57:17

Add a Comment

Login with GitHub to post a comment